示例#1
0
        private void btnDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (DGvTransView.FocusedRowHandle < 0)
            {
                return;
            }

            if (BsfGlobal.FindPermission("Followup Setup-Delete") == false)
            {
                MessageBox.Show("You don't have Rights to Followup Setup-Delete");
                return;
            }
            else
            {
                string sSql = ""; SqlCommand cmd;
                RepositoryItemLookUpEdit cboCallType = barEditItem1.Edit as RepositoryItemLookUpEdit;
                string sType = Convert.ToString(barEditItem1.EditValue);
                if (m_sType == "C")
                {
                    if (Convert.ToBoolean(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("SysDefault"), CommFun.datatypes.varTypeBoolean)) == true)
                    {
                        MessageBox.Show("Do not Delete, This is Default Value"); return;
                    }

                    else
                    {
                        int  iTypeId = Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("CallTypeId"), CommFun.datatypes.vartypenumeric));
                        bool bAns    = false;
                        sSql = "Select CallTypeID From CallSheet Where CallTypeID= " + iTypeId + " " +
                               "Union All " +
                               "Select CallTypeID From LeadRegister Where CallTypeID = " + iTypeId;
                        DataTable      dt  = new DataTable();
                        SqlDataAdapter sda = new SqlDataAdapter(sSql, BsfGlobal.OpenCRMDB());
                        sda.Fill(dt);
                        if (dt.Rows.Count > 0)
                        {
                            bAns = true;
                        }
                        dt.Dispose();
                        sda.Dispose();
                        BsfGlobal.g_CRMDB.Close();
                        if (bAns == true)
                        {
                            MessageBox.Show("Do not Delete, Call Type Already Used"); return;
                        }

                        DialogResult result1 = MessageBox.Show("Do you want to Delete", "CallType Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (result1 == DialogResult.Yes)
                        {
                            sSql = String.Format("DELETE FROM CallType WHERE CallTypeId={0}", Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("CallTypeId"), CommFun.datatypes.vartypenumeric)));
                            cmd  = new SqlCommand(sSql, BsfGlobal.OpenCRMDB());
                            cmd.ExecuteNonQuery();
                            BsfGlobal.g_CRMDB.Close();

                            DGvTransView.DeleteRow(DGvTransView.FocusedRowHandle);
                        }
                    }
                }
                else if (m_sType == "N")
                {
                    if (Convert.ToBoolean(DGvTransView.GetFocusedRowCellValue("SysDefault")) == true)
                    {
                        MessageBox.Show("Do not Delete, This is Default Value"); return;
                    }

                    int  iTypeId = Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("NatureId"), CommFun.datatypes.vartypenumeric));
                    bool bAns    = false;
                    sSql = "Select NatureID From CallSheet Where NatureID= " + iTypeId;
                    DataTable      dt  = new DataTable();
                    SqlDataAdapter sda = new SqlDataAdapter(sSql, BsfGlobal.OpenCRMDB());
                    sda.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        bAns = true;
                    }
                    dt.Dispose();
                    sda.Dispose();
                    BsfGlobal.g_CRMDB.Close();
                    if (bAns == true)
                    {
                        MessageBox.Show("Do not Delete, Nature Already Used"); return;
                    }

                    DialogResult result1 = MessageBox.Show("Do you want to Delete", "Nature Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result1 == DialogResult.Yes)
                    {
                        sSql = String.Format("DELETE FROM NatureMaster WHERE NatureId={0}", CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("NatureId"), CommFun.datatypes.vartypenumeric));
                        cmd  = new SqlCommand(sSql, BsfGlobal.OpenCRMDB());
                        cmd.ExecuteNonQuery();
                        BsfGlobal.g_CRMDB.Close();

                        DGvTransView.DeleteRow(DGvTransView.FocusedRowHandle);
                    }
                }
                else if (m_sType == "S")
                {
                    if (Convert.ToBoolean(DGvTransView.GetFocusedRowCellValue("SysDefault")) == true)
                    {
                        MessageBox.Show("Do not Delete, This is Default Value"); return;
                    }

                    int  iTypeId = Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("StatusId"), CommFun.datatypes.vartypenumeric));
                    bool bAns    = false;
                    sSql = "Select StatusId From CallSheet Where StatusId= " + iTypeId;
                    DataTable      dt  = new DataTable();
                    SqlDataAdapter sda = new SqlDataAdapter(sSql, BsfGlobal.OpenCRMDB());
                    sda.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        bAns = true;
                    }
                    dt.Dispose();
                    sda.Dispose();
                    BsfGlobal.g_CRMDB.Close();
                    if (bAns == true)
                    {
                        MessageBox.Show("Do not Delete, Status Already Used"); return;
                    }

                    DialogResult result1 = MessageBox.Show("Do you want to Delete", "Status Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result1 == DialogResult.Yes)
                    {
                        sSql = String.Format("DELETE FROM StatusMaster WHERE StatusId={0}", CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("StatusId"), CommFun.datatypes.vartypenumeric));
                        cmd  = new SqlCommand(sSql, BsfGlobal.OpenCRMDB());
                        cmd.ExecuteNonQuery();
                        BsfGlobal.g_CRMDB.Close();

                        DGvTransView.DeleteRow(DGvTransView.FocusedRowHandle);
                    }
                }
                //CommFun.InsertLog(DateTime.Now, "Followup Setup-Delete", "D", "Delete Followup Setup", BsfGlobal.g_lUserId, 0, 0, 0, BsfGlobal.g_sCRMDBName);
                BsfGlobal.InsertLog(DateTime.Now, "Followup Setup-Delete", "D", "Delete Followup Setup", Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("StatusId"), CommFun.datatypes.vartypenumeric)), 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId);
            }
        }
示例#2
0
 private void DGvTransView_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (m_sType == "C")
     {
         if (dt.Rows.Count > 0)
         {
             //for (int i = 0; i < dt.Rows.Count; i++)
             //{
             if (Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CallTypeId")) == 1 || Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CallTypeId")) == 2 || Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CallTypeId")) == 3 || Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CallTypeId")) == 4)
             {
                 DGvTransView.Columns["Description"].OptionsColumn.AllowEdit = false;
                 DGvTransView.Columns["Description"].OptionsColumn.ReadOnly  = true;
             }
             else
             {
                 DGvTransView.Columns["Description"].OptionsColumn.AllowEdit = true;
                 DGvTransView.Columns["Description"].OptionsColumn.ReadOnly  = false;
             }
             //}
         }
     }
     else
     {
         DGvTransView.Columns["Description"].OptionsColumn.AllowEdit = true;
         DGvTransView.Columns["Description"].OptionsColumn.ReadOnly  = false;
     }
 }
示例#3
0
        private void btnDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (BsfGlobal.FindPermission("ExtraItem Master-Delete") == false)
            {
                MessageBox.Show("You don't have Rights to ExtraItem Master-Delete");
                return;
            }
            string sql = String.Format("DELETE FROM ExtraItemTypeMaster WHERE ExtraItemTypeId={0}", DGvTransView.GetFocusedRowCellValue("ExtraItemTypeId"));

            using (SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()))
            {
                cmd.ExecuteNonQuery();
            }
            FillData();
        }
        private void btnEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (DGvTransView.FocusedRowHandle < 0)
            {
                return;
            }
            if (BsfGlobal.FindPermission("CRM-ServiceBill-Edit") == false)
            {
                MessageBox.Show("You don't have Rights to Service Quote Bill-Modify", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            //bar1.Visible = false;
            if (DGvTransView.FocusedRowHandle >= 0)
            {
                int argWORegId = Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("RegBillId").ToString());

                string Approve = CommFun.IsNullCheck(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "Approve"), CommFun.datatypes.vartypestring).ToString();
                if (Approve != "Partial" && Approve != "Yes")
                {
                    string sUserName = BsfGlobal.CheckEntryUsed("CRM-ServiceBill-Edit", argWORegId, BsfGlobal.g_sCRMDBName);
                    if (sUserName != "")
                    {
                        string sMsg = "The Entry is already Used by " + sUserName;
                        sMsg = sMsg + ", Do not Edit";
                        MessageBox.Show(sMsg);
                        return;
                    }
                }

                frmServiceOrderBill frmProg = new frmServiceOrderBill()
                {
                    TopLevel = false, FormBorderStyle = System.Windows.Forms.FormBorderStyle.None, Dock = DockStyle.Fill
                };
                if (BsfGlobal.g_bWorkFlow == true)
                {
                    m_oGridMasterView = DGvTransView;
                    m_oGridMasterView.FocusedRowHandle = DGvTransView.FocusedRowHandle;
                    BsfGlobal.g_bTrans = true;
                    m_oDW = (Telerik.WinControls.UI.Docking.DocumentWindow)BsfGlobal.g_oDock.ActiveWindow;
                    m_oDW.Hide();
                    BsfGlobal.g_bTrans = false;
                    Cursor.Current     = Cursors.WaitCursor;
                    PanelControl oPanel = new PanelControl();
                    oPanel = BsfGlobal.GetPanel(frmProg, "Service Order Bill");
                    if ((oPanel == null))
                    {
                        return;
                    }
                    oPanel.Controls.Clear();
                    oPanel.Controls.Add(frmProg);
                    frmProg.Execute(argWORegId);
                    oPanel.Visible = true;
                    Cursor.Current = Cursors.Default;
                }
                else
                {
                    argWORegId = Convert.ToInt32(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "RegBillId"));
                    CommFun.DW1.Hide();
                    frmProg          = new frmServiceOrderBill();
                    CommFun.DW2.Text = "Service Order Bill";
                    frmProg.TopLevel = false;
                    CommFun.RP2.Controls.Clear();
                    frmProg.FormBorderStyle = FormBorderStyle.None;
                    frmProg.Dock            = DockStyle.Fill;
                    CommFun.RP2.Controls.Add(frmProg);
                    frmProg.Execute(argWORegId);
                    CommFun.DW2.Show();
                }
                //if (BsfGlobal.g_bWorkFlow == true)
                //{
                //    BsfGlobal.g_bTrans = true;
                //    m_oDW = (Telerik.WinControls.UI.Docking.DocumentWindow)BsfGlobal.g_oDock.ActiveWindow;
                //    m_oDW.Hide();
                //    BsfGlobal.g_bTrans = false;
                //    Cursor.Current = Cursors.WaitCursor;
                //    PanelControl oPanel = new PanelControl();
                //    oPanel = BsfGlobal.GetPanel(frmService, "Service Order Bill");
                //    if ((oPanel == null))
                //        return;
                //    oPanel.Controls.Clear();
                //    oPanel.Controls.Add(frmService);
                //    frmService.Execute(argWORegId);
                //    oPanel.Visible = true;
                //    Cursor.Current = Cursors.Default;
                //}
                //else
                //{
                //    Cursor.Current = Cursors.WaitCursor;
                //    panelControl1.Controls.Clear();
                //    panelControl1.Controls.Add(frmService);
                //    frmService.Execute(argWORegId);
                //    Cursor.Current = Cursors.Default;
                //}
            }
        }
示例#5
0
        private void DGvTransView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "ExtraItemTypeName").ToString() != string.Empty)
            {
                System.Data.DataRow dr = DGvTransView.GetDataRow(DGvTransView.FocusedRowHandle); //("Total");

                if (DGvTransView.GetFocusedRowCellValue("ExtraItemTypeId") == DBNull.Value)
                {
                    if (CommFun.CheckData("ExtraItemTypeMaster", "ExtraItemTypeName", DGvTransView.GetFocusedRowCellValue("ExtraItemTypeName").ToString(), "Nature Of Complaint") == false)
                    {
                        dr["ExtraItemTypeName"]     = string.Empty;
                        DGvTransView.NewItemRowText = string.Empty;
                        DGvTransView.DeleteRow(DGvTransView.FocusedRowHandle);
                    }
                }
            }
        }
示例#6
0
        private void PopulateData()
        {
            m_bLayOut = false;

            //dETo.EditValue = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            fromDate = Convert.ToDateTime(dEFrm.EditValue);
            if (dETo.EditValue == null)
            {
                dETo.EditValue = Convert.ToDateTime(DateTime.Now);
            }
            toDate = Convert.ToDateTime(dETo.EditValue);
            string fdate = string.Format("{0:dd MMM yyyy}", fromDate);
            string tdate = string.Format("{0:dd MMM yyyy}", toDate);//.AddDays(1));

            dt = new DataTable();
            dt = LeadBL.ShowLeadDate(fdate, tdate, Convert.ToBoolean(chkExec.EditValue));
            DGvTrans.DataSource = dt;
            DGvTrans.ForceInitialize();
            DGvTransView.PopulateColumns();
            DGvTransView.Columns["LeadId"].Visible        = false;
            DGvTransView.Columns["CostCentreId"].Visible  = false;
            DGvTransView.Columns["LeadDate"].Visible      = false;
            DGvTransView.Columns["Mobile"].Visible        = false;
            DGvTransView.Columns["Email"].Visible         = false;
            DGvTransView.Columns["CostCentre"].Visible    = false;
            DGvTransView.Columns["ExecutiveName"].Visible = false;

            DGvTransView.Columns["LeadName"].Width = 240;

            DGvTransView.Columns["LeadId"].OptionsColumn.ShowInCustomizationForm        = false;
            DGvTransView.Columns["CostCentreId"].OptionsColumn.ShowInCustomizationForm  = false;
            DGvTransView.Columns["Email"].OptionsColumn.ShowInCustomizationForm         = false;
            DGvTransView.Columns["CostCentre"].OptionsColumn.ShowInCustomizationForm    = false;
            DGvTransView.Columns["ExecutiveName"].OptionsColumn.ShowInCustomizationForm = false;

            DGvTransView.OptionsCustomization.AllowFilter       = true;
            DGvTransView.OptionsBehavior.AllowIncrementalSearch = true;
            DGvTransView.OptionsView.ShowAutoFilterRow          = true;
            DGvTransView.OptionsView.ShowViewCaption            = false;
            DGvTransView.OptionsView.ShowFooter           = true;
            DGvTransView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect;
            DGvTransView.OptionsSelection.InvertSelection = false;
            DGvTransView.OptionsView.ColumnAutoWidth      = false;
            DGvTransView.Appearance.HeaderPanel.Font      = new Font(DGvTransView.Appearance.HeaderPanel.Font, FontStyle.Bold);
            DGvTransView.FocusedRowHandle = 0;
            DGvTransView.FocusedColumn    = DGvTransView.VisibleColumns[0];


            int m_LeadId = 0;

            panelLeadEntry.Controls.Clear();

            if (DGvTransView.FocusedRowHandle >= 0)
            {
                m_LeadId = Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId"));
                string      s_LeadName = DGvTransView.GetFocusedRowCellValue("LeadName").ToString();
                int         iCCId      = Convert.ToInt32(CommFun.IsNullCheck(DGvTransView.GetFocusedRowCellValue("CostCentreId"), CommFun.datatypes.vartypenumeric));
                frmLeadInfo LeadInfo   = new frmLeadInfo()
                {
                    TopLevel = false, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill
                };
                panelLeadEntry.Controls.Add(LeadInfo);
                LeadInfo.Execute("E", m_LeadId, iCCId, "LeadReg");
            }

            DGvTransView.Appearance.HeaderPanel.Font = new Font(DGvTransView.Appearance.HeaderPanel.Font, FontStyle.Bold);

            DGvTransView.Appearance.FocusedCell.BackColor = Color.Teal;
            DGvTransView.Appearance.FocusedCell.ForeColor = Color.White;
            DGvTransView.Appearance.FocusedRow.ForeColor  = Color.Teal;
            DGvTransView.Appearance.FocusedRow.BackColor  = Color.White;

            DGvTransView.OptionsSelection.EnableAppearanceHideSelection = false;
            //DGvTransView.BestFitColumns();
            BsfGlobal.RestoreLayout("CRMLeadRegister", DGvTransView);
            m_bLayOut = true;
        }
示例#7
0
        private void btnClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (BsfGlobal.FindPermission("Lead-Clear Filter") == false)
            {
                MessageBox.Show("You don't have Rights to Lead-Clear Filter");
                return;
            }
            m_dtFil.Clear();
            DGvTrans.DataSource = null;
            //FillEnquiry();
            PopulateData();

            panelLeadEntry.Controls.Clear();
            frmLeadInfo LeadInfo = new frmLeadInfo()
            {
                TopLevel = false, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill
            };

            panelLeadEntry.Controls.Add(LeadInfo);
            LeadInfo.Execute("E", Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId")), Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CostCentreId")), "LeadReg");
        }
示例#8
0
        private void btnFilter_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (BsfGlobal.FindPermission("Lead-Filter") == false)
            {
                MessageBox.Show("You don't have Rights to Lead-Filter");
                return;
            }
            DataTable dt = new DataTable();

            m_Filter = "";
            frmFilter fFilter = new frmFilter();

            if (m_dtFil.Rows.Count > 0)
            {
                fFilter.Exe(m_dtFil, fromDate, toDate);
            }

            m_Filter = fFilter.Execute(fromDate, toDate);

            if (m_Filter != "")
            {
                m_dtFil = fFilter.m_dtFilter;

                dt = CommFun.FillRecord(m_Filter);
                DGvTrans.DataSource = dt;
                DGvTrans.ForceInitialize();
                DGvTransView.PopulateColumns();
                DGvTransView.Columns["LeadId"].Visible       = false;
                DGvTransView.Columns["CostCentreId"].Visible = false;

                panelLeadEntry.Controls.Clear();
                frmLeadInfo LeadInfo = new frmLeadInfo()
                {
                    TopLevel = false, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill
                };
                panelLeadEntry.Controls.Add(LeadInfo);
                LeadInfo.Execute("E", Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("LeadId")), Convert.ToInt32(DGvTransView.GetFocusedRowCellValue("CostCentreId")), "LeadReg");
            }
            else
            {
                m_dtFil.Clear();
                //FillEnquiry();
            }
            DGvTransView.FocusedRowHandle = i;
        }
示例#9
0
 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;
     }
 }