Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Visual Studio - how to change "var" to corresponding class Pin
#realJSOP25-Aug-16 5:46
mve#realJSOP25-Aug-16 5:46 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
Maarten197725-Aug-16 6:51
Maarten197725-Aug-16 6:51 
GeneralRe: Visual Studio - how to change "var" to corresponding class Pin
Richard Deeming22-Aug-16 2:06
mveRichard Deeming22-Aug-16 2:06 
Questionbrowse ith records on the GridView if errors rerun record or run next record ? Pin
Member 245846719-Aug-16 17:59
Member 245846719-Aug-16 17:59 
AnswerRe: browse ith records on the GridView if errors rerun record or run next record ? Pin
OriginalGriff19-Aug-16 21:43
mveOriginalGriff19-Aug-16 21:43 
AnswerRe: browse ith records on the GridView if errors rerun record or run next record ? Pin
Richard MacCutchan19-Aug-16 22:00
mveRichard MacCutchan19-Aug-16 22:00 
GeneralRe: browse ith records on the GridView if errors rerun record or run next record ? Pin
Member 245846720-Aug-16 17:57
Member 245846720-Aug-16 17:57 
QuestionAT+CREG? command Pin
Mike Angelo Gunao Navales18-Aug-16 22:59
Mike Angelo Gunao Navales18-Aug-16 22:59 
AnswerRe: AT+CREG? command Pin
OriginalGriff18-Aug-16 23:32
mveOriginalGriff18-Aug-16 23:32 
GeneralRe: AT+CREG? command Pin
Mike Angelo Gunao Navales19-Aug-16 1:10
Mike Angelo Gunao Navales19-Aug-16 1:10 
Questionvisual studio 2013 community edition and uml modeling Pin
Tridip Bhattacharjee18-Aug-16 21:52
professionalTridip Bhattacharjee18-Aug-16 21:52 
AnswerRe: visual studio 2013 community edition and uml modeling Pin
Richard MacCutchan18-Aug-16 22:25
mveRichard MacCutchan18-Aug-16 22:25 
AnswerRe: visual studio 2013 community edition and uml modeling Pin
Nathan Minier19-Aug-16 1:00
professionalNathan Minier19-Aug-16 1:00 
AnswerRe: visual studio 2013 community edition and uml modeling Pin
Gerry Schmitz20-Aug-16 8:12
mveGerry Schmitz20-Aug-16 8:12 
QuestionHow to get the currently opened directory in Windows Explorer in .net Pin
srikrishnathanthri17-Aug-16 19:28
srikrishnathanthri17-Aug-16 19:28 
AnswerRe: How to get the currently opened directory in Windows Explorer in .net Pin
Richard MacCutchan17-Aug-16 21:35
mveRichard MacCutchan17-Aug-16 21:35 
Questionconcatenative approach to TTS Pin
Member 1266621417-Aug-16 4:28
Member 1266621417-Aug-16 4:28 
AnswerRe: concatenative approach to TTS Pin
OriginalGriff17-Aug-16 4:51
mveOriginalGriff17-Aug-16 4:51 
AnswerRe: concatenative approach to TTS Pin
Gerry Schmitz17-Aug-16 6:01
mveGerry Schmitz17-Aug-16 6:01 
AnswerRe: concatenative approach to TTS Pin
Bernhard Hiller17-Aug-16 21:51
Bernhard Hiller17-Aug-16 21:51 
QuestionHow to make a border less form draggable inside specified location in .net? Pin
srikrishnathanthri17-Aug-16 1:34
srikrishnathanthri17-Aug-16 1:34 
AnswerRe: How to make a border less form draggable inside specified location in .net? Pin
BillWoodruff17-Aug-16 3:03
professionalBillWoodruff17-Aug-16 3:03 
GeneralRe: How to make a border less form draggable inside specified location in .net? Pin
srikrishnathanthri17-Aug-16 19:09
srikrishnathanthri17-Aug-16 19:09 
GeneralRe: How to make a border less form draggable inside specified location in .net? Pin
BillWoodruff17-Aug-16 21:41
professionalBillWoodruff17-Aug-16 21:41 
Generalhow to create user rights for different forms c# Pin
Member 308047017-Aug-16 1:14
Member 308047017-Aug-16 1:14 
Hi I have windows form.in that

I have table tbluseraction

actionid actionname
-------------------------
1 read
2 write
3 delete

I have another table tbluserform

formid formname
---------------------------------
1 frmbackup
2 frmrestore


Now i want to give premission to each form.I have check box for every permission

after giving rights it is saved in table as

formid actionid
1 1
1 2
2 1


I have given source code and Please help me

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace DERPS
{
public partial class frmERPRights : Form
{

int ModuleCode;
int UserCode;
DataTable dtColumns;
public frmERPRights()
{
InitializeComponent();

}




private void button1_Click(object sender, EventArgs e)
{
dgvERPPermission.Columns.Add("clmFormCode", "Form Code");//0
dgvERPPermission.Columns.Add("clmFormDescription", "Form Description");//1
using (SqlConnection CNN = new SqlConnection(AppManager.GetConnectionString()))
{
CNN.Open();

using (SqlCommand scmd = new SqlCommand()) {

scmd.CommandText = "select ActionCode, ActionName from erpactions where isPermissible=1";

scmd.Connection = CNN;
SqlDataAdapter sda = new SqlDataAdapter(scmd);
dtColumns = new DataTable();
dgvERPPermission.AutoGenerateColumns = false;
sda.Fill(dtColumns);
foreach (DataRow row in dtColumns.Rows)
{
DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
checkColumn.Name = row[0].ToString();
checkColumn.HeaderText = row[1].ToString();
checkColumn.Width = 50;
checkColumn.ReadOnly = false;
checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values
dgvERPPermission.Columns.Add(checkColumn);

}
}
}


using (SqlConnection CNN = new SqlConnection(AppManager.GetConnectionString()))
{
CNN.Open();

using (SqlCommand scmd = new SqlCommand())
{

scmd.CommandText = "select FormCode,FormDescription from ERPFORMS";

scmd.Connection = CNN;
SqlDataAdapter sda = new SqlDataAdapter(scmd);
DataTable dt = new DataTable();
dgvERPPermission.AutoGenerateColumns = false;
sda.Fill(dt);
object[] row1;
foreach (DataRow row in dt.Rows)
{

row1 = new object[] { row[0], row[1] };
dgvERPPermission.Rows.Add(row1);

}


}


}
}

private void tsbSave_Click(object sender, EventArgs e) //to be saved
{
try
{

using (SqlConnection CNN = new SqlConnection(AppManager.GetConnectionString()))
{
CNN.Open();



foreach (DataGridViewRow row in dgvERPPermission.Rows)
{
foreach (DataGridViewCell cell in row.Cells)
{
string value = cell.Value.ToString();
if (cell.Value.ToString() == "true")
{

MessageBox.Show(value);
}

}
}


}

}
catch (Exception ex)
{

}
}
}

}


Thanks

chandran

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.