public void UpdateData() { DataTable dtA = new DataTable(); DataTable dtM = new DataTable(); dtA = m_dt.GetChanges(DataRowState.Added); dtM = m_dt.GetChanges(DataRowState.Modified); if (dtA != null) { for (int i = 0; i < dtA.Rows.Count; i++) { string sSql = String.Format("INSERT INTO dbo.SchDescription(SchDescName, Type) VALUES('{0}', '{1}')", CommFun.IsNullCheck(dtA.Rows[i]["SchDescName"], CommFun.datatypes.vartypestring).ToString(), m_cDescType); CommFun.CRMExecute(sSql); } } if (dtM != null) { for (int i = 0; i < dtM.Rows.Count; i++) { string sSql = String.Format("UPDATE dbo.SchDescription SET SchDescName='{0}', Type='{1}' WHERE SchDescId={2} ", CommFun.IsNullCheck(dtA.Rows[i]["SchDescName"], CommFun.datatypes.vartypestring).ToString(), m_cDescType, Convert.ToInt32(CommFun.IsNullCheck(dtA.Rows[i]["SchDescId"], CommFun.datatypes.vartypenumeric))); CommFun.CRMExecute(sSql); } } }
public void UpdateData() { string sql; DataTable dtA = new DataTable(); DataTable dtM = new DataTable(); dtA = dt.GetChanges(DataRowState.Added); dtM = dt.GetChanges(DataRowState.Modified); if (dtA != null) { for (int i = 0; i < dtA.Rows.Count; i++) { if (dtA.Rows[i]["TypeName"].ToString() != "") { sql = String.Format("INSERT INTO PaySchType (TypeName,Typewise) VALUES('{0}','{1}')", dtA.Rows[i]["TypeName"], true); CommFun.CRMExecute(sql); } } } if (dtM != null) { for (int i = 0; i < dtM.Rows.Count; i++) { if (dtM.Rows[i]["TypeName"].ToString() != "") { sql = String.Format("UPDATE PaySchType SET TypeName='{0}' WHERE TypeId={1} ", dtM.Rows[i]["TypeName"], dtM.Rows[i]["TypeId"]); CommFun.CRMExecute(sql); } } } }
private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdDescView.FocusedRowHandle < 0) { return; } int iSchId = Convert.ToInt32(CommFun.IsNullCheck(grdDescView.GetFocusedRowCellValue("SchDescId"), CommFun.datatypes.vartypenumeric)); if (PaymentScheduleBL.CheckPaymentScheduleDesUsed(iSchId) == true) { MessageBox.Show("Schedule Description Used, Do not Delete"); return; } try { if (MessageBox.Show("Do you want to Delete Row?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string sSql = "DELETE FROM dbo.SchDescription WHERE SchDescId=" + iSchId + " AND Type='" + m_cDescType + "'"; CommFun.CRMExecute(sSql); grdDescView.DeleteRow(grdDescView.FocusedRowHandle); } } catch (Exception ex) { BsfGlobal.CustomException(ex.Message, ex.StackTrace); } }
public void UpdateData() { string sql; //SqlCommand cmd; DataTable dtM = new DataTable(); DataTable dtA = new DataTable(); dtA = dt.GetChanges(DataRowState.Added); dtM = dt.GetChanges(DataRowState.Modified); if (dtA != null) { for (int i = 0; i < dtA.Rows.Count; i++) { sql = String.Format("INSERT INTO ExtraItemTypeMaster (ExtraItemTypeName) VALUES('{0}')", dtA.Rows[i]["ExtraItemTypeName"]); CommFun.CRMExecute(sql); } } if (dtM != null) { for (int i = 0; i < dtM.Rows.Count; i++) { sql = String.Format("UPDATE ExtraItemTypeMaster SET ExtraItemTypeName='{0}' WHERE ExtraItemTypeId={1} ", dtM.Rows[i]["ExtraItemTypeName"], dtM.Rows[i]["ExtraItemTypeId"]); CommFun.CRMExecute(sql); } } }
private void btnDelete_ItemClick(object sender, ItemClickEventArgs e) { if (BsfGlobal.FindPermission("ExtraItem Register-Delete") == false) { MessageBox.Show("You don't have Rights to ExtraItem Register-Delete"); return; } try { if (grdExtraView.FocusedRowHandle >= 0) { string sql; if (MessageBox.Show("Do you want to delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { sql = String.Format("DELETE FROM ExtraItemMaster where ExtraItemId={0}", Convert.ToInt32(grdExtraView.GetFocusedRowCellValue("ExtraItemId"))); CommFun.CRMExecute(sql); grdExtraView.DeleteRow(grdExtraView.FocusedRowHandle); //CommFun.InsertLog(DateTime.Now, "ExtraItem Register-Delete", "D", "Delete ExtraItem Register", BsfGlobal.g_lUserId, 0, 0, 0, BsfGlobal.g_sCRMDBName); BsfGlobal.InsertLog(DateTime.Now, "ExtraItem Register-Delete", "D", "Delete ExtraItem Register", Convert.ToInt32(grdExtraView.GetFocusedRowCellValue("ExtraItemId")), 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); } } } catch (Exception ex) { throw ex; } }
private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BsfGlobal.FindPermission("Lead-Delete") == false) { MessageBox.Show("You don't have Rights to Lead-Delete"); return; } try { if (DGvTransView.FocusedRowHandle >= 0) { if (Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId")) == 0) { string sql = string.Empty; sql = "DELETE FROM LeadRegister WHERE LeadId=" + Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId")) + " "; CommFun.CRMExecute(sql); DGvTransView.DeleteRow(DGvTransView.FocusedRowHandle); //CommFun.InsertLog(DateTime.Now, "Lead Details-Delete", "D", "Delete Lead Details", BsfGlobal.g_lUserId, 0, 0, 0, BsfGlobal.g_sCRMDBName); BsfGlobal.InsertLog(DateTime.Now, "Lead Details-Delete", "D", "Delete Lead Details", Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId")), 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); } else { MessageBox.Show("Already Converted Can't Delete", "CRM"); } } } catch (Exception ex) { throw ex; } }
public void UpdateData() { //SqlCommand cmd; string sql; DataTable dtA = new DataTable(); DataTable dtM = new DataTable(); dtA = dt.GetChanges(DataRowState.Added); dtM = dt.GetChanges(DataRowState.Modified); if (dtA != null) { for (int i = 0; i < dtA.Rows.Count; i++) { sql = String.Format("INSERT INTO Nature_Complaint (NatureComplaint) VALUES('{0}')", dtA.Rows[i]["NatureComplaint"]); CommFun.CRMExecute(sql); } } if (dtM != null) { for (int i = 0; i < dtM.Rows.Count; i++) { sql = String.Format("UPDATE Nature_Complaint SET NatureComplaint='{0}' WHERE ComplaintId={1} ", dtM.Rows[i]["NatureComplaint"], dtM.Rows[i]["ComplaintId"]); CommFun.CRMExecute(sql); } } }
public void UpdateData() { //SqlCommand cmd; string sql; DataTable dtA = new DataTable(); DataTable dtM = new DataTable(); dtA = dt.GetChanges(DataRowState.Added); dtM = dt.GetChanges(DataRowState.Modified); if (dtA != null) { for (int i = 0; i < dtA.Rows.Count; i++) { if (dtA.Rows[i]["OtherCostName"].ToString() != "") { sql = String.Format("INSERT INTO OtherCostMaster (OtherCostName,Area) VALUES('{0}',{1})", dtA.Rows[i]["OtherCostName"], iArea); CommFun.CRMExecute(sql); } } } if (dtM != null) { for (int i = 0; i < dtM.Rows.Count; i++) { if (dtM.Rows[i]["OtherCostName"].ToString() != "") { sql = String.Format("UPDATE OtherCostMaster SET OtherCostName='{0}' WHERE OtherCostId={1} ", dtM.Rows[i]["OtherCostName"], dtM.Rows[i]["OtherCostId"]); CommFun.CRMExecute(sql); } } } }
private void btnDelete_ItemClick(object sender, ItemClickEventArgs e) { if (BsfGlobal.FindPermission("Extra Bill-Delete") == false) { MessageBox.Show("You don't have Rights to Extra Bill-Delete"); return; } try { int iCCId = Convert.ToInt32(CommFun.IsNullCheck(grdBillView.GetFocusedRowCellValue("CostCentreId"), CommFun.datatypes.vartypenumeric)); int iBillRegId = Convert.ToInt32(CommFun.IsNullCheck(grdBillView.GetFocusedRowCellValue("BillRegId"), CommFun.datatypes.vartypenumeric)); BsfGlobal.OpenCRMDB(); string sSql = String.Format("Select COUNT(*) FROM dbo.ReceiptTrans WHERE BillRegId={0} AND CostCentreId={1}", iBillRegId, iCCId); SqlCommand cmd = new SqlCommand(sSql, BsfGlobal.g_CRMDB); int i_Count = Convert.ToInt32(CommFun.IsNullCheck(cmd.ExecuteScalar(), CommFun.datatypes.vartypenumeric)); cmd.Dispose(); BsfGlobal.g_CRMDB.Close(); if (i_Count > 0) { MessageBox.Show("Receipt Raised, Couldnot Delete", "CRM", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("Do you want to delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { sSql = String.Format("DELETE FROM ExtraBillRegister WHERE BillRegId={0}", iBillRegId); CommFun.CRMExecute(sSql); sSql = String.Format("DELETE FROM ExtraBillTrans WHERE BillRegId={0}", iBillRegId); CommFun.CRMExecute(sSql); sSql = String.Format("DELETE FROM ExtraBillRateQ WHERE BillRegId={0}", iBillRegId); CommFun.CRMExecute(sSql); sSql = String.Format("DELETE FROM ExtraBillRateQAbs WHERE BillRegId={0}", iBillRegId); CommFun.CRMExecute(sSql); grdBillView.DeleteRow(grdBillView.FocusedRowHandle); BsfGlobal.InsertLog(DateTime.Now, "ExtraBill-Delete", "D", "Delete ExtraBill Register", Convert.ToInt32(CommFun.IsNullCheck(grdBillView.GetFocusedRowCellValue("BillRegId"), CommFun.datatypes.vartypenumeric)), iCCId, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); MessageBox.Show("Deleted", "CRM", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { throw ex; } }
private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (dgvTransView.GetFocusedRowCellValue("Name").ToString() != string.Empty) { string sql = string.Empty; if (dgvTransView.GetFocusedRowCellValue("Id").ToString() == string.Empty) { dgvTransView.DeleteRow(dgvTransView.FocusedRowHandle); } else { sql = String.Format("DELETE Designation WHERE DesignationId={0} ", Convert.ToInt32(dgvTransView.GetFocusedRowCellValue("Id"))); CommFun.CRMExecute(sql); dgvTransView.DeleteRow(dgvTransView.FocusedRowHandle); } } }
private void dgvTransView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (dgvTransView.GetFocusedRowCellValue("Name").ToString() != string.Empty) { string sql = string.Empty; SqlCommand cmd; int DesId = 0; if (dgvTransView.GetFocusedRowCellValue("Id").ToString() == string.Empty) { sql = String.Format("INSERT INTO Designation(Description) Values ('{0}') SELECT scope_identity(); ", dgvTransView.GetFocusedRowCellValue("Name")); cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); DesId = Convert.ToInt16(cmd.ExecuteScalar().ToString()); dgvTransView.SetRowCellValue(dgvTransView.FocusedRowHandle, "Id", DesId); } else { sql = String.Format("Update Designation SET Description='{0}' WHERE DesignationId={1} ", dgvTransView.GetFocusedRowCellValue("Name"), Convert.ToInt32(dgvTransView.GetFocusedRowCellValue("Id"))); CommFun.CRMExecute(sql); } } }
private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdBrokerView.FocusedRowHandle < 0) { return; } if (BsfGlobal.FindPermission("Broker Details-Delete") == false) { MessageBox.Show("You don't have Rights to Broker-Delete"); return; } try { int i_BrokerId = Convert.ToInt32(grdBrokerView.GetFocusedRowCellValue("BrokerId")); if (UnitDirBL.BrokerFound(i_BrokerId) == false) { if (MessageBox.Show("Do You want to Delete Row?", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK) { string sql; sql = "DELETE FROM BrokerDet WHERE BrokerId=" + i_BrokerId + ""; CommFun.CRMExecute(sql); grdBrokerView.DeleteRow(grdBrokerView.FocusedRowHandle); BsfGlobal.InsertLog(DateTime.Now, "Broker Details-Delete", "D", "Delete Broker Details", i_BrokerId, 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); } } else { MessageBox.Show("Broker Details Used, Can't Delete Row", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } catch (Exception ex) { throw ex; } }
private void btnDelete_ItemClick(object sender, ItemClickEventArgs e) { if (grdCallSheetView.FocusedRowHandle < 0) { return; } if (BsfGlobal.FindPermission("Pre-Followup-Delete") == false) { MessageBox.Show("You don't have Rights to Pre-Followup-Delete"); return; } try { bool bFinalised = CallSheetEntryBL.GetFinalisedFlat(Convert.ToInt32(grdCallSheetView.GetFocusedRowCellValue("EntryId")), Convert.ToInt32(grdCallSheetView.GetFocusedRowCellValue("LeadId"))); if (bFinalised == true) { MessageBox.Show("Cannot Delete Finalized Entry", "Followup", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("Do You Want Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { string sql = string.Empty; sql = "DELETE FROM CallSheet WHERE EntryId=" + Convert.ToInt32(grdCallSheetView.GetFocusedRowCellValue("EntryId")) + " "; CommFun.CRMExecute(sql); grdCallSheetView.DeleteRow(grdCallSheetView.FocusedRowHandle); BsfGlobal.InsertLog(DateTime.Now, "Pre-Followup-Delete", "D", "Pre-Followup", Convert.ToInt32(grdCallSheetView.GetFocusedRowCellValue("EntryId")), 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); } } catch (Exception ex) { BsfGlobal.CustomException(ex.Message, ex.StackTrace); } }