public void prcDisplayDetails(string strParam, string dt) { clsConnection clsCon = new clsConnection(); dsDetail = new System.Data.DataSet(); string sqlQuery1 = ""; Int64 ChkML = 0; sqlQuery1 = "Select dbo.fncCheckML (" + Common.Classes.clsMain.intComId + ", " + Int32.Parse(strParam) + ")"; ChkML = clsCon.GTRCountingDataLarge(sqlQuery1); try { string sqlQuery = "Exec prcGetMLPross " + Int32.Parse(strParam) + "," + Common.Classes.clsMain.intComId + "," + ChkML + ""; clsCon.GTRFillDatasetWithSQLCommand(ref dsDetail, sqlQuery); dsDetail.Tables[0].TableName = "Shift"; DataRow dr; if (dsDetail.Tables["Shift"].Rows.Count > 0) { dr = dsDetail.Tables["Shift"].Rows[0]; txtId.Text = dr["lvId"].ToString(); txtEmpID.Text = dr["EmpCode"].ToString(); txtName.Text = dr["EmpName"].ToString(); txtType.Text = dr["lvType"].ToString(); txtDuration.Text = dr["totalDay"].ToString(); txtSect.Text = dr["SectName"].ToString(); txtGS.Text = dr["GS"].ToString(); txtBS.Text = dr["BS"].ToString(); dtFrom.Text = dr["dtFrom"].ToString(); dtTo.Text = dr["dtTo"].ToString(); txtFirstMonth.Text = dr["FirstSalMonth"].ToString(); txtSecondMonth.Text = dr["SecondSalMonth"].ToString(); txtThirdMonth.Text = dr["ThirdSalMonth"].ToString(); txtFirstAmt.Text = dr["FirstAmt"].ToString(); txtSecondAmt.Text = dr["SecondAmt"].ToString(); txtThirdAmt.Text = dr["ThirdAmt"].ToString(); txtTtlAmt.Text = dr["TtlAmount"].ToString(); txtFirstDays.Text = dr["FirstDays"].ToString(); txtSecondDays.Text = dr["SecondDays"].ToString(); txtThirdDays.Text = dr["ThirdDays"].ToString(); txtTtlDays.Text = dr["TtlDays"].ToString(); txtBonus.Text = dr["OtherBonus"].ToString(); txtDeduct.Text = dr["OtherDeduct"].ToString(); txtFirstInstall.Text = dr["FirstPayment"].ToString(); txtSecondInstall.Text = dr["LastPayment"].ToString(); txtRemarks.Text = dr["MLRemarks"].ToString(); txtNetAmt.Text = dr["NetPayable"].ToString(); checkPaid1.Checked = false; checkPaid2.Checked = false; ChkNoPay.Checked = false; if (dr["FirstPaid"].ToString() == "1") { checkPaid1.Checked = true; } if (dr["LastPaid"].ToString() == "1") { checkPaid2.Checked = true; } if (dr["NoPay"].ToString() == "1") { ChkNoPay.Checked = true; } } CheckEdit.Checked = false; btnSave.Visible = false; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int64 NewId = 0; try { //Member Master Table if (btnSave.Text != "&Save") { //Update sqlQuery = "Update tblEmpCasual_Info set EmpCode = '" + this.txtCode.Text.ToString() + "', empType = '" + this.cboEmpType.Value.ToString() + "', EmpName ='" + this.txtName.Text.ToString() + "',DesigID = '" + this.cboDesig.Value.ToString() + "', SectId= '" + this.cboSec.Value.ToString() + "',dtJoin= '" + clsProc.GTRDate(this.dtJDate.Value.ToString()) + "',dtBirth= '" + clsProc.GTRDate(this.dtBirthDate.Value.ToString()) + "',GS='" + this.txtGS.Text.ToString() + "',ShiftType='G',ShiftID='1',ShiftCat= 'G',Religion='" + this.cboRelegion.Value.ToString() + "',Sex='" + this.cboSex.Value.ToString() + "',ResUser='******',VehicleNo = '" + this.txtTrnNo.Text + "',cardno = '" + this.txtnewcode.Text + "' ,IsAllowOT='" + checkOT.Tag.ToString() + "',IsInactive='" + checkYesNo.Tag.ToString() + "' where empid = '" + this.txtnewcode.Text + "' "; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Update','" + this.txtnewcode.Text + "')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //NewId sqlQuery = "Select Isnull(Max(EmpId),0)+1 As NewId from tblEmpCasual_Info"; NewId = clsCon.GTRCountingDataLarge(sqlQuery); //Insert Data sqlQuery = "Insert Into tblEmpCasual_Info (ComId,aEmpid,Empid, EmpCode, empType, EmpName,DesigID, SectId,CSComId,ResUser,VehicleNo, dtJoin,dtBirth,GS,ShiftType, ShiftID, ShiftCat, Religion, Sex,cardno, IsAllowOT, IsInactive)" + " Values (" + this.cboCom.Value.ToString() + ", " + NewId + ", " + NewId + ",'" + NewId + "', '" + this.cboEmpType.Value.ToString() + "',' " + this.txtName.Text + "', " + this.cboDesig.Value.ToString() + ", " + this.cboSec.Value.ToString() + "," + this.cboCom.Value.ToString() + ",'" + this.cboResUser.Value.ToString() + "','" + this.txtTrnNo.Text + "','" + this.clsProc.GTRDate(this.dtJDate.Value.ToString()) + "','" + clsProc.GTRDate(this.dtBirthDate.Value.ToString()) + "','" + this.txtGS.Text.ToString() + "','G','1', 'G','" + this.cboRelegion.Value.ToString() + "','" + this.cboSex.Value.ToString() + "','" + NewId + "', '" + this.checkOT.Tag.ToString() + "','" + this.checkYesNo.Tag.ToString() + "')"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert'," + NewId + ")"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } prcClearData(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; //cboCode.Value = null; } }
public void prcDisplayDetailsEmp(string strParam) { clsConnection clsCon = new clsConnection(); dsDetails = new System.Data.DataSet(); lvlDataMatchImg.Visible = false; radioFinger2.Checked = false; string SqlQuery = ""; ChkEmpFP = 0; //Position Capacity Checking Code SqlQuery = "Select dbo.fncCheckEmpFinger (" + Int32.Parse(strParam) + ")"; ChkEmpFP = clsCon.GTRCountingDataLarge(SqlQuery); try { SqlQuery = "Exec prcGetEmpFingerRegister 1,'" + Common.Classes.clsMain.intComId + "'," + Int32.Parse(strParam) + ""; clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SqlQuery); dsDetails.Tables[0].TableName = "details"; DataRow dr; if (dsDetails.Tables["details"].Rows.Count > 0) { dr = dsDetails.Tables["details"].Rows[0]; txtId.Text = dr["EmpId"].ToString(); txtEmpCode.Text = dr["EmpCode"].ToString(); txtName.Text = dr["EmpName"].ToString(); txtDesig.Text = dr["DesigName"].ToString(); txtSection.Text = dr["SectName"].ToString(); dtJDate.Text = dr["dtJoin"].ToString(); //btnSave.Text = "&Update"; //btnDelete.Enabled = true; if (dr["EmpPicLocation"].ToString().Length > 0) { if ((EmpPic + "\\" + dr["EmpPicLocation"].ToString()).Length > 0) { if (File.Exists(EmpPic + "\\" + dr["EmpPicLocation"].ToString())) { picPreview.Image = new Bitmap(EmpPic + "\\" + dr["EmpPicLocation"].ToString()); } else { picPreview.Image = new Bitmap(EmpPic + "\\None.jpg"); } } else { picPreview.Image = null; } } } lvlDataMatchImg.ForeColor = Color.Blue; lvlDataMatchImg.Visible = true; lvlDataMatchImg.Text = "Finger Not Registered"; if (ChkEmpFP == 1) { //MessageBox.Show("Capacity over for this position.Please communicate with administrator."); //return; if ( MessageBox.Show("Finger already registered [" + txtName.Text.ToString() + "]. If you want again finger register/update please click Yes", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } lvlDataMatchImg.ForeColor = Color.Blue; lvlDataMatchImg.Visible = true; lvlDataMatchImg.Text = "Finger Already Registered"; } } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }