public List <eSunSpeedDomain.MaterialCentreMasterModel> GetAllMaterials()
        {
            List <eSunSpeedDomain.MaterialCentreMasterModel> lstMaterials = new List <MaterialCentreMasterModel>();

            eSunSpeedDomain.MaterialCentreMasterModel objMat;

            string Query = "SELECT * FROM MaterialCentreMaster";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMat = new MaterialCentreMasterModel();

                objMat.Name         = dr["Name"].ToString();
                objMat.Alias        = dr["Alias"].ToString();
                objMat.Group        = dr["PrintName"].ToString();
                objMat.PrintName    = dr["Group"].ToString();
                objMat.StockAccount = dr["StockAccount"].ToString();
                objMat.ReflectTheStockInBalanceSheet = Convert.ToBoolean(dr["Reflect_StockBalSheet"]);
                objMat.SalesAccount              = dr["SalesAccount"].ToString();
                objMat.PurchaseAccount           = dr["PurchaseAccount"].ToString();
                objMat.AccountinginStockTransfer = dr["Acc_StockTransfer"].ToString();
                objMat.Address = dr["Address"].ToString();

                lstMaterials.Add(objMat);
            }
            return(lstMaterials);
        }
Beispiel #2
0
        public List <MaterialCentreMasterModel> GetAllMaterials()
        {
            List <MaterialCentreMasterModel> lstMaterials = new List <MaterialCentreMasterModel>();
            MaterialCentreMasterModel        objMat;

            string Query = "SELECT * FROM MaterialCentreMaster";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMat = new MaterialCentreMasterModel();

                objMat.MC_Id               = Convert.ToInt32(dr["MC_Id"]);
                objMat.Name                = dr["Name"].ToString();
                objMat.Alias               = dr["Alias"].ToString();
                objMat.PrintName           = dr["PrintName"].ToString();
                objMat.Group               = dr["Group"].ToString();
                objMat.StockAccount        = dr["StockAccount"].ToString();
                objMat.EnableStockinBal    = Convert.ToBoolean(dr["EnableStockinBal"]);
                objMat.SalesAccount        = dr["SalesAccount"].ToString();
                objMat.PurchaseAccount     = dr["PurchaseAccount"].ToString();
                objMat.EnableAccinTransfer = Convert.ToBoolean(dr["EnableAccinTransfer"]);
                objMat.Address             = dr["Address"].ToString();
                objMat.Street              = dr["Street"].ToString();
                objMat.PinCode             = dr["PinCode"].ToString();
                objMat.State               = dr["State"].ToString();
                objMat.City                = dr["City"].ToString();
                objMat.Country             = dr["Country"].ToString();
                objMat.Mobile              = dr["Mobile"].ToString();

                lstMaterials.Add(objMat);
            }
            return(lstMaterials);
        }
Beispiel #3
0
        private void FillMaterialCenterInfo()
        {
            if (MCId == 0)
            {
                tbxGroupName.Focus();
                ClearControls();
                lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                return;
            }
            MaterialCentreMasterModel objMaterial = objmatcenbl.GetAllMaterialsById(MCId);

            tbxGroupName.Text            = objMaterial.GroupName;
            tbxAliasname.Text            = objMaterial.Alias;
            tbxPrintname.Text            = objMaterial.PrintName;
            cbxGroup.SelectedItem        = objMaterial.Group;
            cbxStockaccount.SelectedItem = objMaterial.StockAccount;
            cbxreflectstockinbalancesheet.SelectedItem = Convert.ToString(objMaterial.EnableStockinBal ?"Y":"N");
            cbxSaleAccount.SelectedItem      = objMaterial.SalesAccount;
            cbxPurchaseAccount.SelectedItem  = objMaterial.PurchaseAccount;
            cbxStockaccount.SelectedItem     = objMaterial.SalesAccount;
            tbxAccStocktransfer.SelectedItem = Convert.ToString(objMaterial.EnableAccinTransfer ?"Y":"N");
            tbxAddress.Text  = objMaterial.Address;
            tbxAddress1.Text = objMaterial.Address1;
            tbxAddress2.Text = objMaterial.Address2;
            tbxAddress3.Text = objMaterial.Address3;

            lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
            lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            tbxGroupName.Focus();
        }
Beispiel #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MaterialCentreMasterModel objmodel = objMatMasterBl.GetMaterialCenterByGroupname(tbxGroupName.Text.Trim());

            if (objmodel.GroupName != null)
            {
                MessageBox.Show("Can Not Delete Group Name Under Tag With Item Name.." + objmodel.GroupName);
                tbxGroupName.Focus();
            }
            if (objmodel.GroupName == null)
            {
                bool isDelete = MatObj.DeleteMaterialGroupById(MCGId);
                if (isDelete)
                {
                    MessageBox.Show("Delete Successfully!");
                    MCGId = 0;
                    ClearControls();
                    Administration.List.MaterialcentergrpList frmList = new Administration.List.MaterialcentergrpList();
                    frmList.StartPosition = FormStartPosition.CenterScreen;

                    frmList.ShowDialog();
                    FillMaterialGroupInfo();
                }
            }
        }
Beispiel #5
0
        //List of Material Centermaster By Id
        public MaterialCentreMasterModel GetAllMaterialsById(int id)
        {
            MaterialCentreMasterModel objMat = new MaterialCentreMasterModel();

            string Query = "SELECT * FROM `materialcentremaster` WHERE MC_Id=" + id + "";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMat = new MaterialCentreMasterModel();

                objMat.MC_Id               = Convert.ToInt32(dr["MC_Id"]);
                objMat.GroupName           = dr["Name"].ToString();
                objMat.Alias               = dr["Alias"].ToString();
                objMat.PrintName           = dr["PrintName"].ToString();
                objMat.Group               = dr["Group"].ToString();
                objMat.StockAccount        = dr["StockAccount"].ToString();
                objMat.EnableStockinBal    = Convert.ToBoolean(dr["EnableStockinBal"]);
                objMat.SalesAccount        = dr["SalesAccount"].ToString();
                objMat.PurchaseAccount     = dr["PurchaseAccount"].ToString();
                objMat.EnableAccinTransfer = Convert.ToBoolean(dr["EnableAccinTransfer"]);
                objMat.Address             = dr["Address"].ToString();
                objMat.Address1            = dr["Address1"].ToString();
                objMat.Address2            = dr["Address2"].ToString();
                objMat.Address3            = dr["Address3"].ToString();
            }
            return(objMat);
        }
Beispiel #6
0
        public bool SaveMaterialMaster(MaterialCentreMasterModel objMCM)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            //TODO: NEED TO INCLUDE MISSING PARAMETERS
            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@GroupName", objMCM.GroupName));
                paramCollection.Add(new DBParameter("@Alias", objMCM.Alias));
                paramCollection.Add(new DBParameter("@PrintName", objMCM.PrintName));
                paramCollection.Add(new DBParameter("@Group", objMCM.Group));
                paramCollection.Add(new DBParameter("@StockAccount", objMCM.StockAccount));
                paramCollection.Add(new DBParameter("@EnableStockinBal", objMCM.EnableStockinBal, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SalesAccount", objMCM.SalesAccount));
                paramCollection.Add(new DBParameter("@PurchaseAccount", objMCM.PurchaseAccount));
                paramCollection.Add(new DBParameter("@EnableAccinTransfer", objMCM.EnableAccinTransfer, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@Address", objMCM.Address));
                paramCollection.Add(new DBParameter("@Address1", objMCM.Address1));
                paramCollection.Add(new DBParameter("@Address2", objMCM.Address2));
                paramCollection.Add(new DBParameter("@Address3", objMCM.Address3));
                paramCollection.Add(new DBParameter("@Street", objMCM.Street));
                paramCollection.Add(new DBParameter("@City", objMCM.City));
                paramCollection.Add(new DBParameter("@State", objMCM.State));

                paramCollection.Add(new DBParameter("@Country", objMCM.Country));
                paramCollection.Add(new DBParameter("@PinCode", objMCM.PinCode));
                paramCollection.Add(new DBParameter("@Mobile", objMCM.Mobile));

                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));

                Query = "INSERT INTO materialcentremaster(`Name`,`Alias`,`PrintName`,`Group`,`StockAccount`,`EnableStockinBal`,`SalesAccount`,`PurchaseAccount`," +
                        "`EnableAccinTransfer`,`Address`,`Address1`,`Address2`,`Address3`,`Street`,`City`,`State`,`Country`,`PinCode`,`Mobile`,`CreatedBy`)" +
                        "VALUES(@GroupName,@Alias,@PrintName,@Group,@StockAccount,@EnableStockinBal,@SalesAccount,@PurchaseAccount,@EnableAccinTransfer,@Address,@Address1,@Address2,@Address3,@Street,@City," +
                        "@State,@Counry,@PinCode,@Mobile,@CreatedBy)";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
Beispiel #7
0
        public bool UpdateMaterialMaster(MaterialCentreMasterModel objMCM)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@Name", objMCM.Name));
                paramCollection.Add(new DBParameter("@Alias", objMCM.Alias));
                paramCollection.Add(new DBParameter("@PrintName", objMCM.PrintName));
                paramCollection.Add(new DBParameter("@Group", objMCM.Group));
                paramCollection.Add(new DBParameter("@StockAccount", objMCM.StockAccount));
                paramCollection.Add(new DBParameter("@EnableStockinBal", objMCM.EnableStockinBal, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SalesAccount", objMCM.SalesAccount));
                paramCollection.Add(new DBParameter("@PurchaseAccount", objMCM.PurchaseAccount));
                paramCollection.Add(new DBParameter("@EnableAccinTransfer", objMCM.EnableAccinTransfer, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@Address", objMCM.Address));
                paramCollection.Add(new DBParameter("@Street", objMCM.Street));
                paramCollection.Add(new DBParameter("@City", objMCM.City));
                paramCollection.Add(new DBParameter("@State", objMCM.State));
                paramCollection.Add(new DBParameter("@Country", objMCM.Country));
                paramCollection.Add(new DBParameter("@PinCode", objMCM.PinCode));
                paramCollection.Add(new DBParameter("@Mobile", objMCM.Mobile));
                paramCollection.Add(new DBParameter("@ModifiedBy", "Admin"));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now.ToString()));
                paramCollection.Add(new DBParameter("@MC_Id", objMCM.MC_Id));

                Query = "UPDATE MaterialCentreMaster SET [Name]=@Name,[Alias]=@Alias,[PrintName]=@PrintName,[Group]=@Group," +
                        "[StockAccount]=@StockAccount,[EnableStockinBal]=@EnableStockinBal,[SalesAccount]=@SalesAccount,[PurchaseAccount]=@PurchaseAccount," +
                        "[EnableAccinTransfer]=@EnableAccinTransfer,[Address]=@Address,[Street]=@Street,[City]=@City,[State]=@State,[Country]=@Country,[PinCode]=@PinCode,[Mobile]=@Mobile,[ModifiedBy]=@ModifiedBy,[ModifiedDate]=@ModifiedDate " +
                        " WHERE MC_Id=@MC_Id";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
Beispiel #8
0
        //Get MaterialCenter By Material Group
        public MaterialCentreMasterModel GetMaterialCenterByGroupname(string groupname)
        {
            MaterialCentreMasterModel objMaterial = new MaterialCentreMasterModel();

            string Query = string.Empty;

            Query = "SELECT Name FROM `materialcentremaster` WHERE `Group`='" + groupname + "'";
            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMaterial = new eSunSpeedDomain.MaterialCentreMasterModel();

                objMaterial.GroupName = dr["Name"].ToString();
            }
            return(objMaterial);
        }
Beispiel #9
0
        public bool UpdateMaterialMaster(MaterialCentreMasterModel objMCM)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@GroupName", objMCM.GroupName));
                paramCollection.Add(new DBParameter("@Alias", objMCM.Alias));
                paramCollection.Add(new DBParameter("@PrintName", objMCM.PrintName));
                paramCollection.Add(new DBParameter("@Group", objMCM.Group));
                paramCollection.Add(new DBParameter("@StockAccount", objMCM.StockAccount));
                paramCollection.Add(new DBParameter("@EnableStockinBal", objMCM.EnableStockinBal, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SalesAccount", objMCM.SalesAccount));
                paramCollection.Add(new DBParameter("@PurchaseAccount", objMCM.PurchaseAccount));
                paramCollection.Add(new DBParameter("@EnableAccinTransfer", objMCM.EnableAccinTransfer, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@Address", objMCM.Address));
                paramCollection.Add(new DBParameter("@Address1", objMCM.Address1));
                paramCollection.Add(new DBParameter("@Address2", objMCM.Address2));
                paramCollection.Add(new DBParameter("@Address3", objMCM.Address3));
                paramCollection.Add(new DBParameter("@MC_Id", objMCM.MC_Id));

                Query = "UPDATE `materialcentremaster` SET `Name`=@GroupName,`Alias`=@Alias,`PrintName`=@PrintName,`Group`=@Group," +
                        "`StockAccount`=@StockAccount,`EnableStockinBal`=@EnableStockinBal,`SalesAccount`=@SalesAccount,`PurchaseAccount`=@PurchaseAccount," +
                        "`EnableAccinTransfer`=@EnableAccinTransfer,`Address`=@Address,`Address1`=@Address1,`Address2`=@Address2,`Address3`=@Address3 " +
                        " WHERE `MC_Id`=@MC_Id";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
Beispiel #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MaterialCentreMasterModel objMaster = new MaterialCentreMasterModel();

            objMaster.Name            = tbxGroupName.Text.Trim();
            objMaster.Alias           = tbxAliasname.Text.Trim();
            objMaster.PrintName       = tbxPrintname.Text.Trim();
            objMaster.Group           = cbxGroupname.SelectedItem.ToString();
            objMaster.StockAccount    = cbxStockaccount.SelectedItem.ToString();
            objMaster.PurchaseAccount = cbxPurchaseAccount.SelectedItem.ToString();
            objMaster.SalesAccount    = cbxSaleAccount.SelectedItem.ToString();
            //objMaster.EnableStockinBal = cbxSalesAccount.SelectedItem.ToString() == "Y" ? true : false;
            //objMaster.EnableAccinTransfer = cbxStockTrans.SelectedItem.ToString() == "Y" ? true : false;
            objMaster.Address = tbxAddress.Text.Trim();
            //objMaster.Street = tbxStreet.Text.Trim();

            //CityModel objCity = (CityModel)cbxCity.SelectedItem;
            //objMaster.City = objCity.City_Name.ToString();

            //StateModel objState = (StateModel)cbxState.SelectedItem;
            //objMaster.State = objState.State_Name;

            //objMaster.Country = cbxCountry.SelectedItem.ToString();
            //objMaster.PinCode = tbxPincode.Text.Trim();
            //objMaster.Mobile = tbxMobile.Text.Trim();
            objMaster.CreatedBy = "Admin";

            bool isSuccess = objbal.SaveMaterialMaster(objMaster);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
            }

            //    List<MaterialCentreMasterModel> lstMC = accObj.GetAllMaterials();
            //    dgvList.DataSource = lstMC;

            //    Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!");
            //    d.ShowDialog();
        }
Beispiel #11
0
        public List <MaterialCentreMasterModel> GetAllMaterials()
        {
            List <MaterialCentreMasterModel> lstMaterials = new List <MaterialCentreMasterModel>();
            MaterialCentreMasterModel        objMat;

            string Query = "SELECT * FROM `materialcentremaster`";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objMat = new MaterialCentreMasterModel();

                objMat.MC_Id     = Convert.ToInt32(dr["MC_Id"]);
                objMat.GroupName = dr["Name"].ToString();
                objMat.Alias     = dr["Alias"].ToString();
                objMat.Group     = dr["Group"].ToString();

                lstMaterials.Add(objMat);
            }
            return(lstMaterials);
        }
Beispiel #12
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            MaterialCentreMasterModel objGroup = new MaterialCentreMasterModel();

            objGroup.GroupName        = tbxGroupName.Text.Trim();
            objGroup.Alias            = tbxAliasname.Text.Trim() == null ? string.Empty : tbxAliasname.Text.Trim();
            objGroup.PrintName        = tbxPrintname.Text.Trim() == null ? string.Empty : tbxAliasname.Text.Trim();;
            objGroup.Group            = cbxGroup.SelectedItem.ToString();
            objGroup.StockAccount     = cbxStockaccount.SelectedItem.ToString();
            objGroup.EnableStockinBal = cbxreflectstockinbalancesheet.SelectedItem.ToString() == "Y" ? true : false;

            //In Settings Check Check box This fiels Are Enable
            //objGroup.SalesAccount = cbxSaleAccount.SelectedItem.ToString();
            //objGroup.PurchaseAccount = cbxPurchaseAccount.SelectedItem.ToString();
            //objGroup.EnableAccinTransfer = tbxAccStocktransfer.Text.Trim() == "Y" ? true : false;
            objGroup.Address  = tbxAddress.Text == null ? string.Empty : tbxAddress.Text.Trim();
            objGroup.Address1 = tbxAddress1.Text == null ? string.Empty : tbxAddress1.Text.Trim();
            objGroup.Address2 = tbxAddress2.Text == null ? string.Empty : tbxAddress2.Text.Trim();
            objGroup.Address3 = tbxAddress3.Text == null ? string.Empty : tbxAddress3.Text.Trim();

            objGroup.MC_Id = MCId;

            objGroup.CreatedBy = "Admin";

            bool isSuccess = objmatcenbl.UpdateMaterialMaster(objGroup);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                MCId = 0;
                ClearControls();
                Administration.List.MaterialcenterList frmList = new Administration.List.MaterialcenterList();
                frmList.StartPosition = FormStartPosition.CenterScreen;

                frmList.ShowDialog();
                FillMaterialCenterInfo();
            }
        }