Example #1
0
        private void grdPurchaseBillDetailsDET_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SelectedRow = grdPurchaseBillDetails.CurrentRow.Index;
            int codeValue = grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value.ToInt();

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.Search search = new PurelifeErpClient.Search();
                    search.Id = GetInt(grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value);
                    BindingSource bs = new BindingSource();
                    grdPurchaseBillDetailsDET.DataSource = clientObj.DETDataListing(PurelifeErpClient.PageName.DETDirectEntry, search);
                    //bs.DataSource = grdPurchaseBillDetailsDET.DataSource;
                    //purelifeErpClient.Delete(PurelifeErpClient.PageName.MSTPurchaseBill, id);PurelifeErpClient.PageName.MSTPurchaseBill, id

                    //new DgvFilterManager(grdPurchaseBillDetailsDET);
                }
            }
            catch (Exception exception)
            {
                // ErrorLog.LogErrorInTxtFormat(exception);
                throw exception;
            }
        }
Example #2
0
        public void BindData()
        {
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.Search oSearch = new PurelifeErpClient.Search();
                    oSearch.Type = 1;

                    BindingSource bs = new BindingSource();
                    dtMaster = clientObj.DataListingWithSearch(PurelifeErpClient.PageName.MSTPurchaseBill, oSearch);
                    grdPurchaseBillDetails.DataSource = dtMaster;
                    bs.DataSource = grdPurchaseBillDetails.DataSource;
                    new DgvFilterManager(grdPurchaseBillDetails);
                    if (grdPurchaseBillDetails.DataSource == null)
                    {
                        return;
                    }
                    bs = null;
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #3
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            try
            {
                SelectedRow = grdPurchaseBillDetails.CurrentRow.Index;
                int id = GetInt(grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value);

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    purelifeErpClient.Delete(PurelifeErpClient.PageName.MSTDirectEntry, id);
                    //purelifeErpClient.Close();
                }
                BindData();
                if (id > 0)
                {
                    ShowMessage("Deleted successfully");
                    // Close();
                }
                else
                {
                    ShowMessage("Error Please Try Later");
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Example #4
0
        public void BindData()
        {
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdUserView.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.UserDetails);
                    bs.DataSource          = grdUserView.DataSource;

                    if (grdUserView.DataSource == null)
                    {
                        return;
                    }
                    if (txtUserName != null)
                    {
                        bs.Filter = string.Format("UserName LIKE '%{0}%'", txtUserName.Text);
                    }

                    new DgvFilterManager(grdUserView);
                }
            }
            catch (Exception exception)
            {
                //ErrorLog.LogErrorInTxtFormat(exception);
                throw exception;
            }
        }
Example #5
0
        public void BindData()
        {
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.Search oSearch = new PurelifeErpClient.Search();
                    oSearch.Type = 2;
                    BindingSource bs = new BindingSource();
                    grdPurchaseBillDetails.DataSource = clientObj.DataListingWithSearch(PurelifeErpClient.PageName.MSTPurchaseBill, oSearch);

                    bs.DataSource = grdPurchaseBillDetails.DataSource;
                    new DgvFilterManager(grdPurchaseBillDetails);

                    if (grdPurchaseBillDetails.DataSource == null)
                    {
                        return;
                    }
                    bs = null;
                    //if (ddlPrimaryGroup.SelectedValue.ToString() == "0")
                    //{
                    //    grdPurchaseBillDetails.DataSource = clientObj.grdDataListing(PurelifeErpClient.PageName.MSTPurchaseBill,2);
                    //    bs.DataSource = grdPurchaseBillDetails.DataSource;
                    //}
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
                //throw exception;
            }
        }
Example #6
0
        public void BindData()
        {
            //grdItemGroupView.DataSource = OleDbHelper.ExecuteDataset(Connection.CON, CommandType.Text, " SELECT * from ItemsGroupAdd;").Tables[0];
            //new DgvFilterManager(grdItemGroupView);

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdItemMaster.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.Item);
                    bs.DataSource            = grdItemMaster.DataSource;
                    if (grdItemMaster.DataSource == null)
                    {
                        return;
                    }
                    if (txtSearch.Text != null)
                    {
                        bs.Filter = string.Format("DisplayName LIKE '%{0}%'", txtSearch.Text);
                    }

                    new DgvFilterManager(grdItemMaster);
                    // clientObj.Close();

                    //BindingSource bs = new BindingSource();
                    //bs.DataSource = grdItemMaster.DataSource;
                    //bs.Filter = string.Format("DisplayName LIKE '%{0}%'", txtSearch.Text);
                    //grdItemMaster.DataSource = bs;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #7
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            try
            {
                SelectedRow = grdAccountDetails.CurrentRow.Index;
                int id = GetInt(grdAccountDetails.Rows[SelectedRow].Cells["AccountMasId"].Value);

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    purelifeErpClient.Delete(PurelifeErpClient.PageName.Account, id);
                    //purelifeErpClient.Close();
                }
                BindData();
                if (id > 0)
                {
                    ShowMessage("Deleted successfully");
                    //Close();
                }
                else
                {
                    ShowMessage("Error Please Try Later");
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #8
0
        //private void btnFind_Click(object sender, EventArgs e)
        //{
        //    BindData();
        //    //if (txtsearch.text != null)
        //    //{
        //    //    bindingsource bs = new bindingsource();
        //    //    bs.datasource = grdpartwiseratelist.datasource;
        //    //    bs.filter = string.format("partyname like '%{0}%'", txtsearch.text);
        //    //}
        //}

        //private void btnAdd_Click(object sender, EventArgs e)
        //{

        //}

        //private void btnEdit_Click(object sender, EventArgs e)
        //{

        //}

        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                //SelectedRow = grdAccountDetails.CurrentRow.Index;
                //double codeValue = Convert.ToDouble(grdAccountDetails.Rows[SelectedRow].Cells["AccCode"].Value);
                //DeleteMaster(codeValue);
                SelectedRow = grdPartWiseRateList.CurrentRow.Index;
                int id = GetInt(grdPartWiseRateList.Rows[SelectedRow].Cells["PartyWiseMasId"].Value);

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    purelifeErpClient.Delete(PurelifeErpClient.PageName.PartyWiseItemRate, id);

                    purelifeErpClient.Close();
                }
                BindData();
                if (id > 0)
                {
                    ShowMessage("Deleted successfully");
                    // Close();
                }
                else
                {
                    ShowMessage("Error Please Try Later");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #9
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         SelectedRow = grdPurchaseBillDetails.CurrentRow.Index;
         int id = GetInt(grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value);
         if (id > 0)
         {
             var confirmResult = MessageBox.Show("Are you sure to delete this item ?",
                                                 "Confirm Delete!!",
                                                 MessageBoxButtons.YesNo);
             if (confirmResult == DialogResult.Yes)
             {
                 using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                 {
                     purelifeErpClient.Delete(PurelifeErpClient.PageName.MSTDirectEntry, id);
                     //purelifeErpClient.Close();
                 }
                 MessageBox.Show("Successfully Deleted");
             }
             else
             {
                 return;
             }
         }
         BindData();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Example #10
0
        public void BindData()
        {
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdSoftwareRole.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.SoftwareRole);
                    bs.DataSource = grdSoftwareRole.DataSource;
                    if (grdSoftwareRole.DataSource == null)
                    {
                        return;
                    }
                    if (txtSearch.Text != null)
                    {
                        bs.Filter = string.Format("SoftwareRole LIKE '%{0}%'", txtSearch.Text);
                    }
                    new DgvFilterManager(grdSoftwareRole);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #11
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (CheckRequiredField(ddlGroupName))
                {
                    return;
                }


                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.PartyWiseItemRateDTO objPartyWiseItemRateDO = new PurelifeErpClient.PartyWiseItemRateDTO();
                    objPartyWiseItemRateDO.Id = Code;

                    // objPartyWiseItemRateDO.PartyName       =    txtPartyName.Text.Trim();
                    objPartyWiseItemRateDO.PartyName = GetInt(ddlGroupName.SelectedValue);
                    //addForm.ddlGroupName.SelectedValue = grdAccountDetails.Rows[rowIndex].Cells["AccountGroupMasId"].Value.ToString();
                    objPartyWiseItemRateDO.ItemName         = txtItemName.Text.Trim();
                    objPartyWiseItemRateDO.ItemCode         = txtItemCode.Text.ToFloat();
                    objPartyWiseItemRateDO.PackingRate      = txtItemRate.Text.ToFloat();
                    objPartyWiseItemRateDO.PONo             = txtPONo.Text.Trim();
                    objPartyWiseItemRateDO.AmendmentNo      = txtAmendmentNo.Text.ToInt();
                    objPartyWiseItemRateDO.PODate           = txtPOdate.Text.ToDateTime();
                    objPartyWiseItemRateDO.AmendmentDate    = txtAmendmentDate.Text.ToDateTime();
                    objPartyWiseItemRateDO.PartNo           = txtPartno.Text.Trim();
                    objPartyWiseItemRateDO.ToolSupplyForQty = txtToolSupply.Text.ToFloat();
                    objPartyWiseItemRateDO.ToolRate         = txtToolRate.Text.ToFloat();
                    objPartyWiseItemRateDO.Tax         = txtTax.Text.ToFloat();
                    objPartyWiseItemRateDO.ToolNarr    = txtToolNarr.Text.Trim();
                    objPartyWiseItemRateDO.ProcessName = txtProcessName.Text.Trim();

                    PurelifeErpClient.ERPDTOBase objERPDOBase = objPartyWiseItemRateDO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.PartyWiseItemRate, objERPDOBase);
                    purelifeErpClient.Close();
                }

                viewForm.BindData();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");
                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    ResetControls();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #12
0
        /// <summary>
        /// save button event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckRequiredField(txtGrpName))
                {
                    return;
                }
                if (CheckRequiredField(ddlPrimaryGroup))
                {
                    return;
                }

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.AccountGroupDTO objAccountGroupDO = new PurelifeErpClient.AccountGroupDTO();
                    objAccountGroupDO.Id = Code;

                    objAccountGroupDO.AccountGroupName    = txtGrpName.Text.Trim();
                    objAccountGroupDO.PrimaryAccountGroup = GetInt(ddlPrimaryGroup.SelectedValue);
                    objAccountGroupDO.RefrenceNo          = GetInt(txtReferenceNumber.Text);
                    objAccountGroupDO.BType = Convert.ToChar(ddlBType.SelectedValue);
                    objAccountGroupDO.GType = GetInt(ddlType.SelectedValue);
                    objAccountGroupDO.PrintSummaryTrialBalType = GetInt(ddlPrintSummaryTrialBal.SelectedValue);

                    PurelifeErpClient.ERPDTOBase objERPDOBase = objAccountGroupDO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.AccountGroup, objERPDOBase);
                    viewForm.BindDropDown();
                    purelifeErpClient.Close();
                }

                viewForm.BindData();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");

                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    //viewForm.BindDropDown();
                    ResetControls();
                    //viewForm.BindDropDown();
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckRequiredField(txtOrderNo))
                {
                    return;
                }


                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.MSTSaleOrderReceivingEntryDTO objSaleOrderReceivingEntryDO = new PurelifeErpClient.MSTSaleOrderReceivingEntryDTO();
                    objSaleOrderReceivingEntryDO.Id = Code;

                    objSaleOrderReceivingEntryDO.OrderNo   = txtOrderNo.Text.Trim();
                    objSaleOrderReceivingEntryDO.OrderDate = txtOrderDate.Text.ToDateTime();

                    objSaleOrderReceivingEntryDO.PartyName = GetInt(ddlPartyName.SelectedValue);//AccountGroupMasId
                    //objSaleOrderReceivingEntryDO.Active = ddlActive.SelectedValue.ToString() == "0" ? false : true;
                    objSaleOrderReceivingEntryDO.Remarks = txtRemark.Text.Trim();
                    //objSaleOrderReceivingEntryDO.SNo = txtSNo.Text.ToInt();

                    //objSaleOrderReceivingEntryDO.Qty = txtQty.Text.ToFloat();
                    //objSaleOrderReceivingEntryDO.Rate = txtRate.Text.ToFloat();
                    //objSaleOrderReceivingEntryDO.Amount = txtAmount.Text.ToFloat();
                    objSaleOrderReceivingEntryDO.Total = txtTotal.Text.ToFloat();

                    PurelifeErpClient.ERPDTOBase objERPDOBase = objSaleOrderReceivingEntryDO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.SaleOrderReceivingEntryMST, objERPDOBase);
                    purelifeErpClient.Close();
                }

                viewForm.BindData();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");
                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    ResetControls();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #14
0
        public void LoadMasters()
        {
            try
            {
                menuStrip.Invoke(new Action(() => menuStrip.Enabled = false));
                lblInfo.Invoke(new Action(() => lblInfo.Text        = "Please wait.."));
                using (var purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    Common.Masters.AccountGroup          = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.AccountGroup);
                    Common.Masters.ItemGroup             = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.ItemGroup);
                    Common.Masters.SaleOrderReceivgEntry = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Account);
                    Common.Masters.SaleOrderReceivgEntry = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.SaleOrderReceivingEntryDET);
                    Common.Masters.ItemDesc = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.ItemDescp);
                    Common.Masters.UMO      = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.UMO);

                    Common.Masters.Department   = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Dept);
                    Common.Masters.Designation  = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Desig);
                    Common.Masters.SoftwareRole = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.SoftwareRole);
                    Common.Masters.Location     = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Location);
                    Common.Masters.IssueTo      = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.MSTIssueMaster);

                    DataTable dt     = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Account);
                    DataTable dtTemp = new DataTable();
                    dtTemp.Columns.Add("Code");
                    dtTemp.Columns.Add("Value");
                    dtTemp.Columns.Add("AccType");
                    DataRow[] s   = null;
                    DataRow   row = dtTemp.NewRow();
                    s = dt.Select("AccType=4");
                    foreach (DataRow item in s)
                    {
                        DataRow dr = dtTemp.NewRow();
                        dr["Code"]    = item["Code"];
                        dr["Value"]   = item["Value"];
                        dr["AccType"] = item["AccType"];
                        dtTemp.Rows.Add(dr);
                    }
                    //dtTemp.Rows.Add(dt.Select("AccType=4"));
                    Common.Masters.AccountType = dtTemp;

                    purelifeErpClient.Close();
                }

                lblInfo.Invoke(new Action(() => lblInfo.Text        = ""));
                menuStrip.Invoke(new Action(() => menuStrip.Enabled = true));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #15
0
        private void btnAdd_Click_1(object sender, EventArgs e)
        {
            try
            {
                //if (CheckRequiredField(txtOrderNo))
                //{
                //    return;
                //}
                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.SaleOrderReceivingEntryDTO objSaleOrderReceivingEntryDO = new PurelifeErpClient.SaleOrderReceivingEntryDTO();
                    objSaleOrderReceivingEntryDO.Id = Code;

                    objSaleOrderReceivingEntryDO.SNo = txtSNo.Text.ToInt();
                    // objSaleOrderReceivingEntryDO.ItemDescription = txtItemDescptn.Text.Trim();
                    objSaleOrderReceivingEntryDO.ItemDescription = GetInt(ddlItemDesb.SelectedValue);//txtItemDescptn.Text.Trim();
                    objSaleOrderReceivingEntryDO.Qty             = txtQty.Text.ToFloat();
                    objSaleOrderReceivingEntryDO.Rate            = txtRate.Text.ToFloat();
                    objSaleOrderReceivingEntryDO.Amount          = txtAmount.Text.ToFloat();
                    // objSaleOrderReceivingEntryDO.Total = txtTotal.Text.ToFloat();



                    PurelifeErpClient.ERPDTOBase objERPDOBase = objSaleOrderReceivingEntryDO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.SaleOrderReceivingEntryDET, objERPDOBase);
                    purelifeErpClient.Close();
                }

                viewForm1.BindData1();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");
                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    ResetControls();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #16
0
        public void BindData()
        {
            //grdItemGroupView.DataSource = OleDbHelper.ExecuteDataset(Connection.CON, CommandType.Text, " SELECT * from ItemsGroupAdd;").Tables[0];
            //new DgvFilterManager(grdItemGroupView);

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdAccountDetails.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.Account);
                    bs.DataSource = grdAccountDetails.DataSource;
                    //if (txtByName.Text != null)
                    //{
                    //    bs.Filter = string.Format("AccountName LIKE '%{0}%'", txtByName.Text);
                    //}
                    if (grdAccountDetails.DataSource == null)
                    {
                        return;
                    }
                    if (ddlState.SelectedValue.ToInt() > 0)
                    {
                        bs.Filter = string.Format("State = {0}", ddlState.SelectedValue);
                    }

                    if (ddlPrimaryGroup.SelectedValue.ToInt() > 0)
                    {
                        bs.Filter = string.Format("AccountGroupMasId= {0}", ddlPrimaryGroup.SelectedValue);
                        //bs.Filter = string.Format("AccountGroupMasId", ddlGroupName.SelectedValue);
                    }

                    if (ddlPrimaryGroup.SelectedValue.ToString() == "0")
                    {
                        grdAccountDetails.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.Account);
                        bs.DataSource = grdAccountDetails.DataSource;
                    }
                    new DgvFilterManager(grdAccountDetails);
                }
            }
            catch (Exception exception)
            {
                //ErrorLog.LogErrorInTxtFormat(exception);
                throw exception;
            }
        }
Example #17
0
        //   public SaleOrderReceivingEntryAdd(SaleOrderReceivingEntryAdd view, int code)
        //{
        //    viewForm1 = view;
        //    Code = code;
        //    InitializeComponent();
        //    this.Text = this.Text + " (Edit)";
        //    BindDropDown();
        //}


        public void BindData1()
        {
            //grdItemGroupView.DataSource = OleDbHelper.ExecuteDataset(Connection.CON, CommandType.Text, " SELECT * from ItemsGroupAdd;").Tables[0];
            //new DgvFilterManager(grdItemGroupView);

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    grdSaleOrderReceivingEntry.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.SaleOrderReceivingEntryMST);
                    new DgvFilterManager(grdSaleOrderReceivingEntry);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #18
0
        //private void DeleteMaster(Double codeValue)
        //{
        //    try
        //    {

        //        //base.Delete("AccMas", "AccCode", codeValue.ToString());

        //        BindData();

        //    }
        //    catch (Exception exception)
        //    {
        //        //ErrorLog.LogErrorInTxtFormat(exception);
        //    }

        //}


        #region For Delete
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                //SelectedRow = grdAccountDetails.CurrentRow.Index;
                //double codeValue = Convert.ToDouble(grdAccountDetails.Rows[SelectedRow].Cells["AccCode"].Value);
                //DeleteMaster(codeValue);
                SelectedRow = grdItemMaster.CurrentRow.Index;
                int id = GetInt(grdItemMaster.Rows[SelectedRow].Cells["ItemMasId"].Value);

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    purelifeErpClient.Delete(PurelifeErpClient.PageName.Item, id);

                    purelifeErpClient.Close();
                }
                if (id > 0)
                {
                    var confirmResult = MessageBox.Show("Are you sure to delete this item ?",
                                                        "Confirm Delete!!",
                                                        MessageBoxButtons.YesNo);

                    if (confirmResult == DialogResult.Yes)
                    {
                        MessageBox.Show("Successfully Deleted");
                        // this.Close();
                    }

                    else
                    {
                        return;
                    }
                }


                BindData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #19
0
        public void BindData()
        {
            BindDropDown();
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdAccountGroupDetails.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.AccountGroup);
                    bs.DataSource = grdAccountGroupDetails.DataSource;
                    if (grdAccountGroupDetails.DataSource == null)
                    {
                        return;
                    }
                    if (txtSearch.Text != null)
                    {
                        bs.Filter = string.Format("AccountGroupName LIKE '%{0}%'", txtSearch.Text);
                    }

                    if (ddlPrimaryGroup.SelectedValue.ToInt() > 0)
                    {
                        bs.Filter = string.Format("AccountGroupMasId= {0}", ddlPrimaryGroup.SelectedValue);
                        //bs.Filter = string.Format("AccountGroupMasId", ddlGroupName.SelectedValue);
                    }
                    if (ddlPrimaryGroup.SelectedValue.ToString() == "0")
                    {
                        grdAccountGroupDetails.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.AccountGroup);
                        bs.DataSource = grdAccountGroupDetails.DataSource;
                    }
                    new DgvFilterManager(grdAccountGroupDetails);


                    //clientObj.Close();ddlPrimaryGroup
                }
            }
            //dt.Columns.Add("date", typeof(string), tbdate.Text);
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #20
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                SelectedRow = grdUMOView.CurrentRow.Index;
                int id = GetInt(grdUMOView.Rows[SelectedRow].Cells["Id"].Value);

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    purelifeErpClient.Delete(PurelifeErpClient.PageName.UMO, id);
                    purelifeErpClient.Close();
                }
                if (id > 0)
                {


                    var confirmResult = MessageBox.Show("Are you sure to delete this item ?",
                       "Confirm Delete!!",
                       MessageBoxButtons.YesNo);

                    if (confirmResult == DialogResult.Yes)
                    {
                        MessageBox.Show("Successfully Deleted");
                        // this.Close();
                    }

                    else
                    {
                        return;
                    }
                }


                BindData();
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #21
0
        public void BindData()
        {
            //grdItemGroupView.DataSource = OleDbHelper.ExecuteDataset(Connection.CON, CommandType.Text, " SELECT * from ItemsGroupAdd;").Tables[0];
            //new DgvFilterManager(grdItemGroupView);

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdSaleOrderDetial1.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.SaleOrderReceivingEntryMST);
                    bs.DataSource = grdSaleOrderDetial1.DataSource;

                    //if (ddlPrimaryGroup.SelectedValue.ToInt() > 0)
                    //{
                    //    bs.Filter = string.Format("AccountGroupMasId= {0}", ddlPrimaryGroup.SelectedValue);
                    //    //bs.Filter = string.Format("AccountGroupMasId", ddlGroupName.SelectedValue);
                    //}

                    //if (ddlPrimaryGroup.SelectedValue.ToString() == "0")
                    //{
                    //    grdSaleOrderDetial1.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.SaleOrderReceivingEntry);
                    //    bs.DataSource = grdSaleOrderDetial1.DataSource;
                    //}

                    new DgvFilterManager(grdSaleOrderDetial1);

                    //grdSaleOrderDetail2.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.SaleOrderReceivingEntry);
                    //new DgvFilterManager(grdSaleOrderDetail2);

                    //BindingSource bs = new BindingSource();
                    //bs.DataSource = grdSaleOrderDetail2.DataSource;
                    //grdSaleOrderDetial1.DataSource = bs;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #22
0
        private void grdPurchaseBillDetails_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SelectedRow = grdPurchaseBillDetails.CurrentRow.Index;
            int codeValue = grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value.ToInt();

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.Search search = new PurelifeErpClient.Search();
                    search.Id = GetInt(grdPurchaseBillDetails.Rows[SelectedRow].Cells["PurchaseBillId"].Value);
                    BindingSource bs = new BindingSource();
                    dtDetails = clientObj.DETDataListing(PurelifeErpClient.PageName.DETPurchaseBill, search);
                    grdPurchaseBillDetailsDET.DataSource = dtDetails;
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
                throw exception;
            }
        }
Example #23
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckRequiredField(txtUMOName))
                {
                    return;
                }


                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.UMODTO objUMODO = new PurelifeErpClient.UMODTO();
                    objUMODO.Id   = Code;
                    objUMODO.Name = txtUMOName.Text.Trim();
                    PurelifeErpClient.ERPDTOBase objERPDOBase = objUMODO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.UMO, objERPDOBase);
                    purelifeErpClient.Close();
                }


                viewForm.BindData();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");
                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    ResetControls();
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Example #24
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool status = true;

            try
            {
                string username = txtUserName.Text;
                string password = txtPassword.Text;
                if (username.ToString() == "" && password.ToString() == "")
                {
                    MessageBox.Show("Enter username and password");
                    return;
                }
                else
                {
                    using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                    {
                        PurelifeErpClient.Result res = purelifeErpClient.UserLogin(PurelifeErpClient.PageName.MSTUserDetails, username, password);
                        if (res.Id.ToInt() > 0)
                        {
                            SessionManager.UserCode = res.Id;
                            SessionManager.UserName = username;
                            this.Close();
                            _k.Value = "true";
                            Close();
                        }
                        else
                        {
                            ShowError.SetError(txtPassword, "Please enter correct details");
                            base.ShowMessage("Invalid user, Please enter correct details");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Login failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #25
0
        public void BindData()
        {
            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdUMOView.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.UMO);
                    bs.DataSource = grdUMOView.DataSource;
                    if (grdUMOView.DataSource == null) return;
                    if (txtSearch.Text != null)
                    {
                        bs.Filter = string.Format("Name LIKE '%{0}%'", txtSearch.Text);
                    }
                    new DgvFilterManager(grdUMOView);
                }
            }

            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #26
0
        public void BindData()
        {
            //grdItemGroupView.DataSource = OleDbHelper.ExecuteDataset(Connection.CON, CommandType.Text, " SELECT * from ItemsGroupAdd;").Tables[0];
            //new DgvFilterManager(grdItemGroupView);

            try
            {
                using (PurelifeErpClient.PurelifeErpClient clientObj = new PurelifeErpClient.PurelifeErpClient())
                {
                    BindingSource bs = new BindingSource();
                    grdPartWiseRateList.DataSource = clientObj.DataListing(PurelifeErpClient.PageName.PartyWiseItemRate);
                    bs.DataSource = grdPartWiseRateList.DataSource;
                    if (grdPartWiseRateList.DataSource == null)
                    {
                        return;
                    }
                    if (txtSearch.Text != null)
                    {
                        bs.Filter = string.Format("AccountGroupName LIKE '%{0}%'", txtSearch.Text);
                    }
                    new DgvFilterManager(grdPartWiseRateList);
                    clientObj.Close();


                    //if (txtsearch.text != null)
                    //{
                    //    bindingsource bs = new bindingsource();
                    //    bs.datasource = grdpartwiseratelist.datasource;
                    //    bs.filter = string.format("partyname like '%{0}%'", txtsearch.text);
                    //}
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #27
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // SaveClicked();
            try
            {
                if (CheckRequiredField(txtAccountType))
                {
                    return;
                }
                //if (CheckRequiredField(ddlAccountType))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlDrCr))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlActive))
                //{
                //    return;
                //}
                //if (CheckRequiredField( ddlAdjBillWise))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlCustomerType))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlLockAcc))
                //{
                //    return;
                //}
                if (CheckRequiredField(ddlPrimaryGroup))
                {
                    return;
                }
                //if (CheckRequiredField(ddlPurchaseType))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlSaleType))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlState))
                //{
                //    return;
                //}
                //if (CheckRequiredField(ddlTypeOfSupplier))
                //{
                //    return;
                //}


                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    PurelifeErpClient.AccountDTO objAccountDO = new PurelifeErpClient.AccountDTO();
                    objAccountDO.Id = Code.ToInt();

                    objAccountDO.Account      = txtAccountType.Text.Trim();            //AccountName
                    objAccountDO.GroupName    = GetInt(ddlPrimaryGroup.SelectedValue); //AccountGroupMasId
                    objAccountDO.AccountType  = GetInt(ddlAccountType.SelectedValue);
                    objAccountDO.Balance      = GetInt(txtBalance.Text);
                    objAccountDO.DrCr         = GetInt(ddlDrCr.SelectedValue);
                    objAccountDO.State        = GetInt(ddlState.SelectedValue);
                    objAccountDO.SaleType     = GetInt(ddlSaleType.SelectedValue);
                    objAccountDO.PurchaseType = GetInt(ddlPurchaseType.SelectedValue);

                    objAccountDO.Address      = txtAddress1.Text;
                    objAccountDO.MobileNo     = txtMobileNo.Text.ToInt();
                    objAccountDO.Email        = txtEmail.Text.Trim();
                    objAccountDO.Registration = txtRegistration.Text.Trim();
                    objAccountDO.PLACodeNo    = txtPLACodeNo.Text.Trim();
                    objAccountDO.Commodity    = txtCommodity.Text.Trim();
                    objAccountDO.Range        = txtRange.Text.Trim();
                    objAccountDO.Division     = txtDivision.Text.Trim();
                    objAccountDO.Collactorate = txtCollactorate.Text.Trim();

                    objAccountDO.PanNo       = txtPanNo.Text.Trim();
                    objAccountDO.CSTNo       = txtCSTNo.Text.Trim();
                    objAccountDO.STNo        = txtSTNo.Text.Trim();
                    objAccountDO.ECCNo       = txtECCNo.Text.Trim();
                    objAccountDO.CreditDays  = txtCreditDays.Text.Trim();
                    objAccountDO.AdjBillWise = ddlAdjBillWise.SelectedValue.ToString() == "0" ? false : true;
                    objAccountDO.TDSRate     = txtTDSRate.Text.Trim();

                    objAccountDO.TDSCategory     = txtTDSCategory.Text.Trim();
                    objAccountDO.LockAcc         = ddlLockAcc.SelectedValue.ToString() == "0" ? false : true;
                    objAccountDO.ModeofTransport = txtModeofTransport.Text.Trim();
                    objAccountDO.NatureofPay     = txtNatureofPay.Text.Trim();
                    objAccountDO.VenderCode      = txtVenderCode.Text.Trim();
                    objAccountDO.TypeOfSupplier  = GetInt(ddlTypeOfSupplier.SelectedValue);
                    objAccountDO.Country         = txtCountry.Text.Trim();
                    objAccountDO.Destination     = txtDestination.Text.Trim();

                    objAccountDO.Fax          = txtFax.Text.Trim();
                    objAccountDO.CodeNo       = txtCodeNo.Text.Trim();
                    objAccountDO.Discount     = txtDiscount.Text.Trim();
                    objAccountDO.CustomerType = GetInt(ddlCustomerType.SelectedValue);
                    objAccountDO.Location     = txtLocation.Text.Trim();
                    objAccountDO.IntrestRate  = txtIntrestRate.Text.Trim();
                    objAccountDO.Active       = ddlActive.SelectedValue.ToString() == "0" ? false : true;


                    PurelifeErpClient.ERPDTOBase objERPDOBase = objAccountDO as PurelifeErpClient.ERPDTOBase;
                    purelifeErpClient.Save(PurelifeErpClient.PageName.Account, objERPDOBase);
                    purelifeErpClient.Close();
                }

                viewForm.BindData();

                if (Code > 0)
                {
                    ShowMessage("Updated successfully");
                    viewForm.BindDropDown();
                    Close();
                }
                else
                {
                    ShowMessage("Saved successfully");
                    ResetControls();
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string GRNNo = "";

            try
            {
                if (grdGRNDetails.Rows.Count == 0)
                {
                    MessageBox.Show("Please Add Details ");
                }

                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    #region masters
                    PurelifeErpClient.MSTGRNDTO objMSTGRNDTO = new PurelifeErpClient.MSTGRNDTO();

                    objMSTGRNDTO.Id                = Code;
                    objMSTGRNDTO.SupplierName      = GetInt(ddlSupplierName.SelectedValue);
                    objMSTGRNDTO.DCBillInvoiceNo   = txtDCBillInvoiceNo.Text;
                    objMSTGRNDTO.DcBillInvoiceDate = txtDCBillInvoiceDate.Text.ToDateTime().Date;
                    objMSTGRNDTO.GRNNo             = txtGRNNo.Text;
                    objMSTGRNDTO.GRNDate           = txtGRNDate.Text.ToDateTime().Date;
                    objMSTGRNDTO.LLRRWayBillNo     = txtLLRRWayBillNo.Text;
                    objMSTGRNDTO.LLRRWayBillDate   = txtLLRRWayBillDate.Text.ToDateTime().Date;
                    objMSTGRNDTO.PONo              = txtPONo.Text;
                    objMSTGRNDTO.PODate            = txtPODate.Text.ToDateTime().Date;
                    objMSTGRNDTO.Prepared          = txtPrepared.Text.Trim();
                    objMSTGRNDTO.StoreIncharge     = txtStoreIncharge.Text.Trim();
                    objMSTGRNDTO.MaterialManager   = txtMaterialManager.Text.Trim();
                    objMSTGRNDTO.PostedIntoStockBy = txtPostedIntoStockBy.Text.Trim();
                    PurelifeErpClient.ERPDTOBase objERPDOBase = objMSTGRNDTO as PurelifeErpClient.ERPDTOBase;
                    PurelifeErpClient.Result     res          = purelifeErpClient.Save(PurelifeErpClient.PageName.MSTPurchaseBill, objERPDOBase);

                    int    i      = 5 - res.Id.ToString().Length;
                    string result = new string('0', i);
                    string prefix = "GRN/" + DateTime.Now.Year.ToString().Substring(2) + "-" + DateTime.Now.AddYears(1).Year.ToString().Substring(2) + "/";
                    GRNNo = string.Format("{0}{1}{2}", prefix, result, res.Id);

                    #endregion

                    #region Details

                    if (res.Id > 0)
                    {
                        for (int sno = 0; sno < grdGRNDetails.Rows.Count; sno++)
                        {
                            try
                            {
                                PurelifeErpClient.DETGRNDTO objDETGRNDTO = new PurelifeErpClient.DETGRNDTO();
                                objDETGRNDTO.Id                     = res.Id;
                                objDETGRNDTO.SNo                    = grdGRNDetails.Rows[sno].Cells["SNo"].Value.ToInt();
                                objDETGRNDTO.MaterialDesc           = grdGRNDetails.Rows[sno].Cells["MaterialDescId"].Value.ToInt();
                                objDETGRNDTO.UnitCode               = grdGRNDetails.Rows[sno].Cells["UnitCodeId"].Value.ToInt();
                                objDETGRNDTO.DC                     = grdGRNDetails.Rows[sno].Cells["DC"].Value.ToInt();
                                objDETGRNDTO.Recieved               = grdGRNDetails.Rows[sno].Cells["Recieved"].Value.ToInt();
                                objDETGRNDTO.AcceptedIntoStock      = grdGRNDetails.Rows[sno].Cells["AcceptedIntoStock"].Value.ToInt();
                                objDETGRNDTO.MaterialCheckingSlipNo = grdGRNDetails.Rows[sno].Cells["MaterialCheckingSlipNo"].Value.ToString();
                                objDETGRNDTO.Value                  = grdGRNDetails.Rows[sno].Cells["Value"].Value.ToFloat();
                                PurelifeErpClient.ERPDTOBase objERPDOBaseDET = objDETGRNDTO as PurelifeErpClient.ERPDTOBase;
                                purelifeErpClient.Save(PurelifeErpClient.PageName.DETPurchaseBill, objERPDOBaseDET);
                            }
                            catch (Exception ex)
                            {
                                Common.ErrorLog.LogErrorInTxtFormat(ex);
                            }
                        }
                    }
                    #endregion

                    purelifeErpClient.Close();
                    if (Code > 0)
                    {
                        ShowMessage("Updated successfully");
                        //  viewForm.BindData();
                        Close();
                    }
                    else
                    {
                        ShowMessage(String.Format("Saved successfully, Your Serial No is {0}", GRNNo));
                        ResetMasterControls();
                        ResetDetailControls();
                        grdGRNDetails.Rows.Clear();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string billSno = "";

            try
            {
                if (grdPurchaseBillDetailsDET.Rows.Count == 0)
                {
                    MessageBox.Show("Please Add Details");
                }
                if (CheckRequiredField(ddlPurchaseAccount))
                {
                    return;
                }
                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    #region masters
                    PurelifeErpClient.MSTPurchaseBillDTO objPurchaseBillDOMST = new PurelifeErpClient.MSTPurchaseBillDTO();
                    objPurchaseBillDOMST.Id             = Code;
                    objPurchaseBillDOMST.SerialBillNo   = billSno;
                    objPurchaseBillDOMST.Entrydate      = txtEntryDate.Text.ToDateTime();
                    objPurchaseBillDOMST.Entrydate      = txtEntryDate.Text.ToDateTime();
                    objPurchaseBillDOMST.BillNo         = txtBillNo.Text.Trim();
                    objPurchaseBillDOMST.BillDate       = txtBillDate.Text.ToDateTime();
                    objPurchaseBillDOMST.Narration      = txtNarration.Text.Trim();
                    objPurchaseBillDOMST.PurchaseCategy = GetInt(ddlPurchaseCategory.SelectedValue);
                    objPurchaseBillDOMST.PurchaseType   = GetInt(ddlPurchaseType.SelectedValue);
                    objPurchaseBillDOMST.PurchaseAcc    = GetInt(ddlPurchaseAccount.SelectedValue);
                    objPurchaseBillDOMST.ExciseNo       = txtExcise.Text.ToFloat();//   Excise Duty against form 'CT1'
                    objPurchaseBillDOMST.Cess           = txtCess.Text.ToFloat();
                    objPurchaseBillDOMST.HECess         = txtHECess.Text.ToFloat();
                    objPurchaseBillDOMST.AddExcise      = ddlAddExcise.SelectedValue.ToString() == "0" ? false : true;
                    objPurchaseBillDOMST.ExciseReg      = txtExciseReg.Text.ToFloat();
                    //objPurchaseBillDOMST.ExciseNo = txtExciseNo.Text.ToFloat();
                    objPurchaseBillDOMST.Transport                 = txtTransport.Text.Trim();
                    objPurchaseBillDOMST.Carrier                   = txtCarrier.Text.Trim();
                    objPurchaseBillDOMST.Remarks                   = txtRemark.Text.Trim();
                    objPurchaseBillDOMST.TotalAmount               = txtMSTTotalAmount.Text.ToFloat();
                    objPurchaseBillDOMST.Freightnsurance           = txtFrieghtInsurance.Text.Trim();
                    objPurchaseBillDOMST.PackingForwarding         = txtPackingForword.Text.Trim();
                    objPurchaseBillDOMST.SaleTax                   = txtSaleTax.Text.ToFloat(); //Sales Tax against form 'H'
                    objPurchaseBillDOMST.SurchargeTax              = txtSurchargeTax.Text.ToFloat();
                    objPurchaseBillDOMST.BillAmount                = txtBillAmount.Text.ToFloat();
                    objPurchaseBillDOMST.MakeIssueToProductionBill = ddlIssueToProduction.SelectedValue.ToString() == "0" ? false : true;
                    objPurchaseBillDOMST.Type = 1;//

                    PurelifeErpClient.ERPDTOBase objERPDOBase = objPurchaseBillDOMST as PurelifeErpClient.ERPDTOBase;
                    PurelifeErpClient.Result     res          = purelifeErpClient.Save(PurelifeErpClient.PageName.MSTPurchaseBill, objERPDOBase);

                    int    i      = 4 - res.Id.ToString().Length;
                    string result = new string('0', i);
                    string prefix = "PB/" + DateTime.Now.Year.ToString().Substring(2) + "-" + DateTime.Now.AddYears(1).Year.ToString().Substring(2) + "/";
                    billSno = string.Format("{0}{1}{2}", prefix, result, res.Id);

                    #endregion
                    #region Details


                    if (res.Id > 0)
                    {
                        for (int sno = 0; sno < grdPurchaseBillDetailsDET.Rows.Count; sno++)
                        {
                            PurelifeErpClient.DETPurchaseBillDTO objPurchaseBillDO = new PurelifeErpClient.DETPurchaseBillDTO();
                            objPurchaseBillDO.Id = res.Id;

                            objPurchaseBillDO.SNo          = grdPurchaseBillDetailsDET.Rows[sno].Cells["SNo"].Value.ToInt();
                            objPurchaseBillDO.MaterialDesc = grdPurchaseBillDetailsDET.Rows[sno].Cells["ItemId"].Value.ToInt();
                            objPurchaseBillDO.UMOId        = grdPurchaseBillDetailsDET.Rows[sno].Cells["UOMId"].Value.ToInt();
                            objPurchaseBillDO.Qty          = grdPurchaseBillDetailsDET.Rows[sno].Cells["Qty"].Value.ToFloat();
                            objPurchaseBillDO.Rate         = grdPurchaseBillDetailsDET.Rows[sno].Cells["Rate"].Value.ToFloat();
                            objPurchaseBillDO.TotalAmount  = grdPurchaseBillDetailsDET.Rows[sno].Cells["Amount"].Value.ToFloat();


                            //objPurchaseBillDO.DiscPerc = grdPurchaseBillDetailsDET.Rows[sno].Cells["DiscPerc"].Value.ToFloat();
                            // objPurchaseBillDO.DicsAmount = grdPurchaseBillDetailsDET.Rows[sno].Cells["DicsAmount"].Value.ToFloat();
                            // objPurchaseBillDO.ExciseDuty = grdPurchaseBillDetailsDET.Rows[sno].Cells["ExciseDuty"].Value.ToFloat();

                            //objPurchaseBillDO.ECess = grdPurchaseBillDetailsDET.Rows[sno].Cells["ECess"].Value.ToFloat();
                            //  objPurchaseBillDO.HECessPerc = grdPurchaseBillDetailsDET.Rows[sno].Cells["HECessPerc"].Value.ToFloat();


                            //  objPurchaseBillDO.HECessAmount = grdPurchaseBillDetailsDET.Rows[sno].Cells["HECessAmount"].Value.ToFloat();
                            //  objPurchaseBillDO.InvoiceDate = grdPurchaseBillDetailsDET.Rows[sno].Cells["InvoiceDate"].Value.ToDateTime();

                            //  objPurchaseBillDO.ETADate = grdPurchaseBillDetailsDET.Rows[sno].Cells["ETADate"].Value.ToDateTime();
                            //  objPurchaseBillDO.Specs = grdPurchaseBillDetailsDET.Rows[sno].Cells["Specs"].Value.ToString();

                            //  objPurchaseBillDO.Tariff = grdPurchaseBillDetailsDET.Rows[sno].Cells["Tariff"].Value.ToString();
                            //  objPurchaseBillDO.CVDAmount = grdPurchaseBillDetailsDET.Rows[sno].Cells["CVDAmount"].Value.ToFloat();

                            //  objPurchaseBillDO.TotalAmount = grdPurchaseBillDetailsDET.Rows[sno].Cells["TotalAmount"].Value.ToFloat();

                            PurelifeErpClient.ERPDTOBase objERPDOBaseDET = objPurchaseBillDO as PurelifeErpClient.ERPDTOBase;
                            purelifeErpClient.Save(PurelifeErpClient.PageName.DETPurchaseBill, objERPDOBaseDET);
                        }
                    }
                    #endregion
                    purelifeErpClient.Close();

                    //txtSerialBillNo.Text = (Convert.ToInt32(txtSerialBillNo.Text + 1)).ToString();
                    //txtSerialBillNo.Text = (int.Parse(txtSerialBillNo.Text) + 1).ToString();

                    if (Code > 0)
                    {
                        ShowMessage("Updated successfully");
                        viewForm.BindData();
                        Close();
                    }
                    else
                    {
                        ShowMessage(String.Format("Saved successfully, Your Serial No is {0}", billSno));
                        viewForm.BindData();
                        ResetMasterControls();
                        ResetDetailControls();
                        this.grdPurchaseBillDetailsDET.DataSource = null;
                        grdPurchaseBillDetailsDET.Rows.Clear();
                        // SerialBillNo();

                        //txtSerialBillNo.Text = (int.Parse(txtSerialBillNo.Text) + 1).ToString();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }
Example #30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string IssueSno = "";
            {
                try
                {
                    if (grdIssueMaster.Rows.Count == 0)
                    {
                        MessageBox.Show("Please add  information");
                        return;
                    }
                    if (CheckRequiredField(ddlIssueTo))
                    {
                        return;
                    }
                    if (CheckRequiredField(txtOrderDate))
                    {
                        return;
                    }


                    #region masters
                    using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                    {
                        PurelifeErpClient.MSTIssueMasterDTO oMSTIssueMasterDTO = new PurelifeErpClient.MSTIssueMasterDTO();
                        oMSTIssueMasterDTO.Id        = Code;
                        oMSTIssueMasterDTO.OrderNo   = txtOrderNo.Text.Trim();
                        oMSTIssueMasterDTO.Orderdate = txtOrderDate.Text.ToDateTime();
                        oMSTIssueMasterDTO.Remarks   = txtRemarks.Text.Trim();
                        oMSTIssueMasterDTO.IssueTo   = GetInt(ddlIssueTo.SelectedValue);

                        PurelifeErpClient.ERPDTOBase objERPDOBase = oMSTIssueMasterDTO as PurelifeErpClient.ERPDTOBase;
                        PurelifeErpClient.Result     res          = purelifeErpClient.Save(PurelifeErpClient.PageName.MSTIssueMaster, objERPDOBase);

                        int    i      = 4 - res.Id.ToString().Length;
                        string result = new string('0', i);
                        string prefix = "ISM/" + DateTime.Now.Year.ToString().Substring(2) + "-" + DateTime.Now.AddYears(1).Year.ToString().Substring(2) + "/";
                        IssueSno = string.Format("{0}{1}{2}", prefix, result, res.Id);

                        #endregion

                        #region Details
                        if (res.Id > 0)
                        {
                            for (int sno = 0; sno < grdIssueMaster.Rows.Count; sno++)
                            {
                                PurelifeErpClient.DETIssueUserDTO oDETIssueUserDTO = new PurelifeErpClient.DETIssueUserDTO();
                                oDETIssueUserDTO.Id           = res.Id;
                                oDETIssueUserDTO.SNo          = grdIssueMaster.Rows[sno].Cells["SNo"].Value.ToInt();
                                oDETIssueUserDTO.MaterialDesc = grdIssueMaster.Rows[sno].Cells["ItemId"].Value.ToInt();
                                oDETIssueUserDTO.UMOId        = grdIssueMaster.Rows[sno].Cells["UOMId"].Value.ToInt();
                                oDETIssueUserDTO.Qty          = grdIssueMaster.Rows[sno].Cells["Qty"].Value.ToFloat();

                                PurelifeErpClient.ERPDTOBase objERPDOBaseDET = oDETIssueUserDTO as PurelifeErpClient.ERPDTOBase;
                                purelifeErpClient.Save(PurelifeErpClient.PageName.DETIssueMaster, objERPDOBaseDET);
                            }
                        }
                        #endregion
                        purelifeErpClient.Close();

                        if (Code > 0)
                        {
                            ShowMessage("Updated successfully");
                            viewForm.BindData();
                            Close();
                        }
                        else
                        {
                            ShowMessage(String.Format("Saved successfully, Your Order No is {0}", IssueSno));
                            viewForm.BindData();
                            ResetMasterControls();
                            txtSno.Text = "";
                            ResetDetailControls();
                            grdIssueMaster.Rows.Clear();
                        }
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.LogErrorInTxtFormat(ex);
                }
            }
        }