Example #1
0
        private static bool CheckData(Company obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + COMPANY.COMPANY_TBL + " WHERE " + COMPANY.COMPANY_ID + " = '" + company_id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Company_id   = redr[COMPANY.COMPANY_ID].ToString();
                    obj.Company_name = redr[COMPANY.COMPANY_NAME].ToString();
                    //obj.Display_name = redr[COMPANY.DISPLAY_NAME].ToString();
                    obj.City_id    = CCity_exten.GetId_Name(ChangeCase.UpperFirst(obj.City_id));
                    obj.State_id   = CState_exten.GetId_Name(ChangeCase.UpperFirst(obj.State_id));
                    obj.Country_id = CCountry_exten.GetId_Name(obj.Country_id.ToUpper());
                    obj.Pincode_id = CPincode_exten.GetId_Name(obj.Pincode_id.Replace(" ", string.Empty));

                    CCompany.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
Example #2
0
        private void Save_Event()
        {
            if (Validation() != false)
            {
                switch (fAction)
                {
                case BtnEvent.Open:
                    this.Hide();
                    RaiseEvent_NeedToRefresh();
                    break;

                case BtnEvent.Edit:
                    try
                    {
                        var vData = CollectData();

                        dalsession = new DAL();
                        dalsession.BeginTransaction();
                        CCompany.Update(vData, dalsession);
                        dalsession.Commit();

                        MessageBox.Show(this.FindForm(), "Record Updated Successfully.", "Update...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Hide();
                        RaiseEvent_NeedToRefresh();
                    }
                    catch (Exception ex)
                    {
                        if (dalsession != null)
                        {
                            dalsession.Rollback();
                        }
                        MessageBox.Show(this.FindForm(), "Something Goes Wrong \r\n" + ex.Message, "Could Not Update...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        SetFocus();
                        return;
                    }
                    break;
                }
            }
        }