Exemple #1
0
        public void disableButton(SCContractType ct)
        {
            if (!ct.isCollective)
            {
                this.headerControl1.btnNewSelfContract.Enabled = false;
                this.headerControl1.btnDelSelfContract.Enabled = false;
                //delete collective contract
                if (objContract.SelfContracts != null && objContract.SelfContracts.Count > 0)
                {
                    foreach (CollectiveContract c in objContract.SelfContracts)
                    {
                        c.isDeleted = true;
                    }
                }

                if (this.headerControl1.dgvSelfContract.DataSource != null)
                {
                    this.headerControl1.dgvSelfContract.DataSource = null;
                }
            }
            else
            {
                this.headerControl1.btnNewSelfContract.Enabled = true;
                this.headerControl1.btnDelSelfContract.Enabled = true;
            }
        }
Exemple #2
0
        public SCContractType findContracTypeByOiD(int oid, List <SCContractType> list)
        {
            SCContractType sc = new SCContractType();

            sc = list.SingleOrDefault(x => x.OID == oid);

            return(sc);
        }
Exemple #3
0
        private void delBtn_Click(object sender, EventArgs e)
        {
            if (contractTypeList.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow r in contractTypeList.SelectedRows)
                {
                    var       myOid  = r.Cells[0].Value;
                    string    search = "OID = " + myOid.ToString();
                    DataRow[] rows   = this.dt.Select(search);
                    foreach (DataRow row in rows)
                    {
                        SCContractType sc = null;
                        sc = RowToContractType(r);
                        sc.isMarkDeleted = true;

                        if (sc != null)
                        {
                            var item = sCContractTypes.Find(x => x.OID == sc.OID);
                            if (item == null && sc.OID > 0)
                            {
                                this.sCContractTypes.Add(sc);
                            }
                            else if (item == null && sc.OID < 0)
                            {
                                //this.sCContractTypes.Remove(item);
                            }
                            else if (item != null && sc.OID < 0)
                            {
                                this.sCContractTypes.Remove(item);
                            }
                            else if (item != null && sc.OID > 0)
                            {
                                this.sCContractTypes.Remove(item);
                                this.sCContractTypes.Add(sc);
                            }
                            //row.Delete();
                            if (row["isMarkDeleted"].ToString() == "True")
                            {
                                row["isMarkDeleted"] = 0;
                                this.sCContractTypes.Remove(sc);
                                ViewUtils.remarkHeader(r, Constant.isMarkDeleted);
                            }
                            else
                            {
                                row["isMarkDeleted"] = 1;
                                ViewUtils.remarkHeader(r, Constant.isMarkDeleted);
                            }
                            //MessageBox.Show(row["isMarkDeleted"].ToString());
                        }
                    }
                }
                contractTypeList.Refresh();
            }
        }
Exemple #4
0
        private void newBtn_Click(object sender, EventArgs e)
        {
            // MessageBox.Show(datasource.Count.ToString());
            SCContractType sc = new SCContractType(newOid);


            //sc.Name = "";
            //sc.isInvoice = false;
            //sc.isActive = false;
            //sc.isCollective = false;
            //sc.isMarkDeleted = false;


            DataTable dataTable = (DataTable)contractTypeList.DataSource;
            DataRow   drToAdd   = dataTable.NewRow();

            drToAdd["OID"] = newOid;
            //drToAdd["Name"] = "";
            drToAdd["isInvoice"]     = false;
            drToAdd["isActive"]      = true;
            drToAdd["isCollective"]  = false;
            drToAdd["isMarkDeleted"] = false;
            drToAdd["isLeadExport"]  = false;

            dataTable.Rows.InsertAt(drToAdd, 0);
            dataTable.AcceptChanges();
            this.contractTypeList.Refresh();
            this.contractTypeList.Rows[0].Selected = true;

            DataGridViewCell cell = contractTypeList.Rows[0].Cells["ContractTypeName"];

            contractTypeList.CurrentCell = cell;
            this.contractTypeList.BeginEdit(true);

            newOid = newOid - 1;


            this.sCContractTypes.Add(sc);
        }
Exemple #5
0
        //public DataGridViewRow ContractTypeToRow(SCContractType sc, DataGridViewRow row)
        //{
        //    //  DataGridViewRow row = new DataGridViewRow();


        //    row.Cells[0].Value = sc.OID.ToString();
        //    row.Cells[1].Value = sc.Name;
        //    row.Cells[2].Value = sc.isInvoice;
        //    row.Cells[3].Value = sc.isActive;
        //    row.Cells[4].Value = sc.isCollective;
        //    row.Cells[5].Value = sc.isMarkDeleted;

        //    return row;
        //}

        private void contractTypeList_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int colIndex = e.ColumnIndex;
            // MessageBox.Show(colIndex.ToString());
            DataGridViewRow row = contractTypeList.Rows[rowIndex];
            SCContractType  sc  = new SCContractType();

            sc = RowToContractType(row);
            //MessageBox.Show(sc.isActive.ToString());

            var item = sCContractTypes.Find(x => x.OID == sc.OID);

            if (item == null)
            {
                sCContractTypes.Add(sc);
            }
            else
            {
                sCContractTypes.Remove(item);
                sCContractTypes.Add(sc);
            }
        }
Exemple #6
0
        public SCContractType RowToContractType(DataGridViewRow row)
        {
            SCContractType sc     = new SCContractType();
            int            number = -1;
            bool           tmp    = Int32.TryParse(row.Cells[0].Value.ToString(), out number);

            if (tmp)
            {
                sc.OID = number;
            }
            else
            {
                sc.OID = -1;
            }

            sc.Name          = row.Cells[1].Value.ToString();
            sc.isInvoice     = (bool)row.Cells[2].Value;
            sc.isActive      = (bool)row.Cells[3].Value;
            sc.isCollective  = (bool)row.Cells[4].Value;
            sc.isMarkDeleted = (bool)row.Cells[5].Value;
            sc.isLeadExport  = (bool)row.Cells[6].Value;

            return(sc);
        }
Exemple #7
0
 private void checkInvoiceToCustomer()
 {
     if (this.headerControl1.cbxContractType.SelectedValue != null)
     {
         SCContractType ct = (SCContractType)this.headerControl1.cbxContractType.SelectedItem;
         if (ct != null)
         {
             if (ct.isInvoice)
             {
                 this.headerControl1.chkInvoiceToCus.Checked   = true;
                 this.headerControl1.chkInvoiceToCus.ForeColor = SystemColors.ControlText;
             }
             else
             {
                 this.headerControl1.chkInvoiceToCus.Checked   = false;
                 this.headerControl1.chkInvoiceToCus.ForeColor = SystemColors.ControlText;
             }
             //update contract Type
             objContract.ContractTypeOID = ct;
             // this.headerControl1.cbxContractType.SelectedItem = ct;
             this.disableButton(ct);
         }
     }
 }
 public void loadTree()
 {
     SCContractType = ContractFrm.objContract.ContractTypeOID;
     myCategories   = SCContractType.getOptionPriceList(SCContractType.OID);
     buidTree();
 }