コード例 #1
0
ファイル: OfficeDB.cs プロジェクト: suhasrake/CSLERP
 public static void fillOfficeIDGridViewComboNew(DataGridViewComboBoxCell cmb)
 {
     cmb.Items.Clear();
     try
     {
         OfficeDB      officedb = new OfficeDB();
         List <office> Offices  = officedb.getOffices();
         foreach (office off in Offices)
         {
             if (off.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(off.name, off.OfficeID);
                 cmb.Items.Add(ch);
                 //cmb.Items.Add(off.OfficeID + "-" + off.name);
             }
         }
         cmb.DisplayMember = "Name";  // Name Property will show(Editing)
         cmb.ValueMember   = "Value"; // Value Property will save(Saving)
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
コード例 #2
0
ファイル: OfficeDB.cs プロジェクト: suhasrake/CSLERP
 public static void fillOfficeIDGridViewCombo(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         OfficeDB      officedb = new OfficeDB();
         List <office> Offices  = officedb.getOffices();
         foreach (office off in Offices)
         {
             if (off.status == 1)
             {
                 cmb.Items.Add(off.OfficeID + "-" + off.name);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
コード例 #3
0
ファイル: OfficeDB.cs プロジェクト: suhasrake/CSLERP
 public static void fillOfficeCombo(System.Windows.Forms.ComboBox cmb)
 {
     cmb.Items.Clear();
     try
     {
         OfficeDB      officedb = new OfficeDB();
         List <office> Offices  = officedb.getOffices();
         foreach (office off in Offices)
         {
             if (off.status == 1)
             {
                 cmb.Items.Add(off.OfficeID + "-" + off.name);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
コード例 #4
0
 public static void fillRegionWiseOfficeCombo(System.Windows.Forms.ComboBox cmb, string region)
 {
     cmb.Items.Clear();
     try
     {
         OfficeDB      officedb = new OfficeDB();
         List <office> Offices  = officedb.getOfficesfromregion(region);
         foreach (office off in Offices)
         {
             if (off.status == 1)
             {
                 ////cmb.Items.Add(off.OfficeID + "-" + off.name);
                 Structures.ComboBoxItem cbitem =
                     new Structures.ComboBoxItem(off.name, off.OfficeID);
                 cmb.Items.Add(cbitem);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
コード例 #5
0
ファイル: LeaveSettingsdb.cs プロジェクト: suhasrake/CSLERP
        //16-04-2018
        public static ListView getOfficeListView()
        {
            ListView lv = new ListView();

            try
            {
                lv.View               = View.Details;
                lv.LabelEdit          = true;
                lv.AllowColumnReorder = true;
                lv.CheckBoxes         = true;
                lv.FullRowSelect      = true;
                lv.GridLines          = true;
                lv.Sorting            = System.Windows.Forms.SortOrder.Ascending;
                OfficeDB      OffDB   = new OfficeDB();
                List <office> OffList = OffDB.getOffices();
                ////int index = 0;
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("OfficeID", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Office Name", -2, HorizontalAlignment.Left);
                foreach (office offc in OffList)
                {
                    if (offc.status == 1)
                    {
                        ListViewItem item1 = new ListViewItem();
                        item1.Checked = false;
                        item1.SubItems.Add(offc.OfficeID.ToString());
                        item1.SubItems.Add(offc.name.ToString());
                        lv.Items.Add(item1);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(lv);
        }
コード例 #6
0
        public static void fillCatalogValueComboNew2(System.Windows.Forms.ComboBox cmb, System.Windows.Forms.ComboBox cmb2, System.Windows.Forms.ComboBox cmb3, System.Windows.Forms.Label Label)
        {
            cmb.Items.Clear();
            cmb2.Items.Clear();
            cmb3.Items.Clear();
            try
            {
                CatalogueValueDB        dbrecord        = new CatalogueValueDB();
                List <cataloguevalue>   CatalogueValues = dbrecord.getCatalogueValues().Where(W => W.catalogueID == "POType").ToList();
                List <documentreceiver> ListL2          = new List <documentreceiver>();
                List <documentreceiver> ListL3          = new List <documentreceiver>();
                List <documentreceiver> ListL           = Main.DocumentReceivers.Where(W => W.Status == 1).ToList();
                OfficeDB   obj2    = new OfficeDB();
                DocumentDB obj3    = new DocumentDB();
                var        Ofices  = obj2.getOffices().Where(W => W.status == 1).ToList();
                string     DocName = "";
                foreach (var itm in ListL)
                {
                    documentreceiver obj = new documentreceiver();
                    DocName          = itm.DocumentID;
                    DocName          = DocName.Replace("POSERVICEINWARD", "Service PO");
                    DocName          = DocName.Replace("PAFSERVICEINWARD", "ServicePAF");
                    DocName          = DocName.Replace("POPRODUCTINWARD", "Product PO");
                    DocName          = DocName.Replace("PAFPRODUCTINWARD", "ProductPAF");
                    obj.DocumentName = DocName;
                    obj.OfficeID     = itm.OfficeID;
                    obj.OfficeName   = itm.OfficeName;
                    obj.DocumentID   = itm.DocumentID;
                    ListL2.Add(obj);
                }
                string[] Str = new string[4];
                ////int i = 0;
                foreach (var itm in CatalogueValues)
                {
                    documentreceiver obj = new documentreceiver();
                    DocName          = itm.description;
                    DocName          = DocName.Replace("Service PO", "POSERVICEINWARD");
                    DocName          = DocName.Replace("ServicePAF", "PAFSERVICEINWARD");
                    DocName          = DocName.Replace("Product PO", "POPRODUCTINWARD");
                    DocName          = DocName.Replace("ProductPAF", "PAFPRODUCTINWARD");
                    obj.DocumentID   = DocName;
                    obj.DocumentName = itm.description;
                    ListL3.Add(obj);
                }
                var abcsd = from Ca in CatalogueValues
                            join Ll in ListL2 on Ca.description equals Ll.DocumentName
                            select new
                {
                    DocumentName = Ca.description,
                    DocumentID   = Ll.DocumentID,
                    Ofice        = Ll.OfficeID,
                    OficeName    = Ll.OfficeName
                };
                var Off = from Ca in Ofices
                          join Ll in abcsd on Ca.OfficeID equals Ll.Ofice
                          select Ca;


                // cmb.Items.AddRange(ListL.ToArray());
                foreach (var itm in abcsd.GroupBy(x => x.DocumentName).Select(y => y.FirstOrDefault()).ToList())
                {
                    Structures.ComboBoxItem cbitem =
                        new Structures.ComboBoxItem(itm.DocumentName, itm.DocumentID);
                    cmb.Items.Add(cbitem);
                }
                var Abcd2 = abcsd.GroupBy(x => x.Ofice).Select(y => y.FirstOrDefault()).ToList();
                foreach (var itm in Abcd2)
                {
                    Structures.ComboBoxItem cbitem2 =
                        new Structures.ComboBoxItem(itm.OficeName, itm.Ofice);
                    cmb2.Items.Add(cbitem2);
                }
                foreach (var itm in Ofices.GroupBy(G => G.RegionID))
                {
                    Structures.ComboBoxItem cbitem =
                        new Structures.ComboBoxItem(itm.Key, itm.Select(s => s.RegionName).FirstOrDefault());
                    cmb3.Items.Add(cbitem);
                }

                if (ListL.Count <= 0)
                {
                    Label.Text = "1";
                    var Documents = obj3.getDocuments().Where(W => W.DocumentStatus == 1).ToList();
                    var results   = from x in Documents
                                    join Ll in ListL3 on x.DocumentID equals Ll.DocumentID
                                    select new
                    {
                        DocumntId   = x.DocumentID,
                        documntname = Ll.DocumentName
                    };
                    foreach (var itm in results)
                    {
                        Structures.ComboBoxItem cbitem =
                            new Structures.ComboBoxItem(itm.documntname, itm.DocumntId);
                        cmb.Items.Add(cbitem);
                    }
                    foreach (var itm in Ofices)
                    {
                        Structures.ComboBoxItem cbitem =
                            new Structures.ComboBoxItem(itm.name, itm.OfficeID);
                        cmb2.Items.Add(cbitem);
                    }
                    // offli = Ofices.ToList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
        }
コード例 #7
0
        public static DataGridView getGridViewForPayeeDetails()
        {
            DataGridView grdPOPI = new DataGridView();

            try
            {
                string[] strColArr = { "ID", "Name", "StateCode", "Type" };
                DataGridViewTextBoxColumn[] colArr =
                {
                    new DataGridViewTextBoxColumn(), new DataGridViewTextBoxColumn(), new DataGridViewTextBoxColumn(), new DataGridViewTextBoxColumn()
                };

                DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
                dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
                dataGridViewCellStyle1.BackColor          = System.Drawing.Color.LightSeaGreen;
                dataGridViewCellStyle1.Font               = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.WindowText;
                dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                dataGridViewCellStyle1.WrapMode           = System.Windows.Forms.DataGridViewTriState.True;
                grdPOPI.EnableHeadersVisualStyles         = false;
                grdPOPI.AllowUserToAddRows            = false;
                grdPOPI.AllowUserToDeleteRows         = false;
                grdPOPI.BackgroundColor               = System.Drawing.SystemColors.GradientActiveCaption;
                grdPOPI.BorderStyle                   = System.Windows.Forms.BorderStyle.None;
                grdPOPI.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
                grdPOPI.EditMode            = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
                grdPOPI.ColumnHeadersHeight = 27;
                grdPOPI.RowHeadersVisible   = false;
                grdPOPI.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
                DataGridViewCheckBoxColumn colChk = new DataGridViewCheckBoxColumn();
                colChk.Width      = 50;
                colChk.Name       = "Select";
                colChk.HeaderText = "Select";
                colChk.ReadOnly   = false;
                grdPOPI.Columns.Add(colChk);
                foreach (string str in strColArr)
                {
                    int index = Array.IndexOf(strColArr, str);
                    colArr[index].Name       = str;
                    colArr[index].HeaderText = str;
                    colArr[index].ReadOnly   = true;

                    //if (index == 1 || index == 3)
                    //    colArr[index].DefaultCellStyle.Format = "dd-MM-yyyy";
                    //if (index == 6)
                    //    colArr[index].Width = 350;
                    //else if (index == 2)
                    //    colArr[index].Width = 100;
                    //else
                    //    colArr[index].Width = 80;
                    //if (index == 5 || index == 11)
                    //    colArr[index].Visible = false;
                    //else
                    //    colArr[index].Visible = true;
                    grdPOPI.Columns.Add(colArr[index]);
                }
                EmployeePostingDB      edb     = new EmployeePostingDB();
                List <employeeposting> EMPList = EmployeePostingDB.getEmployeePostingList();
                foreach (employeeposting emp in EMPList)
                {
                    grdPOPI.Rows.Add();
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[0]].Value = emp.empID.ToString();
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[1]].Value = emp.empName;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[2]].Value = "";
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[3]].Value = "Employee";
                }

                CustomerDB cdb = new CustomerDB();
                //List<customer> CustList = cdb.getCustomers("", 6);
                List <customer> CustList = cdb.getCustomerList();
                foreach (customer cust in CustList)
                {
                    grdPOPI.Rows.Add();
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[0]].Value = cust.CustomerID;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[1]].Value = cust.name;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[2]].Value = cust.StateName;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[3]].Value = "Party";
                }

                OfficeDB      offDb   = new OfficeDB();
                List <office> offList = offDb.getOffices().Where(off => off.status == 1).ToList();
                foreach (office off in offList)
                {
                    grdPOPI.Rows.Add();
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[0]].Value = off.OfficeID;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[1]].Value = off.name;
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[2]].Value = "";
                    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[3]].Value = "Office";
                }
                //BankBranchDB bankDB = new BankBranchDB();
                //List<bankbranch> BankList = bankDB.getBankBranches();
                //foreach (bankbranch bank in BankList)
                //{
                //    grdPOPI.Rows.Add();
                //    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[0]].Value = bank.BranchID;
                //    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[1]].Value = bank.BranchName;
                //    grdPOPI.Rows[grdPOPI.Rows.Count - 1].Cells[strColArr[2]].Value = "bank";
                //}
            }
            catch (Exception ex)
            {
            }

            return(grdPOPI);
        }