コード例 #1
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);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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);
                }
            }
        }
コード例 #5
0
        //private void SetDetailValue(int sno)
        //{
        //    if (sno <= 0 || sno > (grdPurchaseBillDetailsDET.Rows.Count))
        //    { return; }

        //    txtDSno.Text = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["SNO"].Value.ToString();
        //    txtDItemCode.Text = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["AliasItemCode"].Value.ToString();
        //    ddlDItemDesc.SelectedValue = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["ItemDecsId"].Value.ToString();
        //    ddlDUMO.SelectedValue = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["UOMId"].Value.ToString();
        //    txtDQuantity.Text = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["Qty"].Value.ToString();
        //    txtDRate.Text = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["Rate"].Value.ToString();
        //    txtDTotalAmt.Text = grdPurchaseBillDetailsDET.Rows[sno - 1].Cells["TotalAmount"].Value.ToString();
        //}



        private void btnSave_Click_1(object sender, EventArgs e)
        {
            string billSno = "";

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

                #region Validation
                //if (CheckRequiredField(txtSerialBillNo))
                //    return;
                //    if (CheckRequiredField(ddlItemDesc))
                //return;
                if (CheckRequiredField(ddlPurchaseAccount))
                {
                    return;
                }
                //if (CheckRequiredField(ddlPurchaseBill))
                //{
                //    return;
                //}

                //if (CheckRequiredField(ddlPurchaseType))
                //{
                //    return;
                //}

                //if (CheckRequiredField(ddlUMO))
                //{
                //    return;
                //}
                #endregion

                if (grdPurchaseBillDetailsDET.Rows.Count == 0)
                {
                    MessageBox.Show("Please add  information");
                    //return;
                }


                using (PurelifeErpClient.PurelifeErpClient purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    #region masters
                    PurelifeErpClient.MSTPurchaseBillDTO objPurchaseBillDOMST = new PurelifeErpClient.MSTPurchaseBillDTO();

                    objPurchaseBillDOMST.Id = Code;

                    objPurchaseBillDOMST.SerialBillNo = txtSerialBillNo.Text.Trim();
                    objPurchaseBillDOMST.Entrydate    = txtEntryDate.Text.ToDateTime().Date;
                    objPurchaseBillDOMST.BillNo       = txtBillNo.Text.Trim();
                    objPurchaseBillDOMST.BillDate     = txtBillDate.Text.ToDateTime().Date;
                    //objPurchaseBillDO.Supplier =         GetInt(ddlSupplier.SelectedValue);
                    objPurchaseBillDOMST.Narration      = txtNarration.Text.Trim();
                    objPurchaseBillDOMST.PurchaseCategy = GetInt(ddlPurchaseCategory.SelectedValue);
                    objPurchaseBillDOMST.PurchaseType   = GetInt(ddlPurchaseType.SelectedValue);
                    objPurchaseBillDOMST.PurchaseAcc    = GetInt(ddlPurchaseAccount.SelectedValue);
                    objPurchaseBillDOMST.TotalAmount    = txtTotalAmount.Text.ToFloat();
                    objPurchaseBillDOMST.Type           = 2;

                    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 = "DE/" + 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++)
                        {
                            try
                            {
                                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();

                                PurelifeErpClient.ERPDTOBase objERPDOBaseDET = objPurchaseBillDO as PurelifeErpClient.ERPDTOBase;
                                purelifeErpClient.Save(PurelifeErpClient.PageName.DETPurchaseBill, objERPDOBaseDET);
                            }
                            catch (Exception ex)
                            {
                                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}", billSno));
                        // ShowMessage("Saved successfully");
                        viewForm.BindData();
                        ResetMasterControls();
                        ResetDetailControls();
                        grdPurchaseBillDetailsDET.Rows.Clear();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLog.LogErrorInTxtFormat(exception);
            }
        }