protected void grdBooksetDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            SetofBooks _objSOBook = new SetofBooks();
            _objSOBook.BooksetDetailID = Convert.ToInt32(((Label)grdBooksetDetails.Rows[e.RowIndex].FindControl("lblBSDetailId")).Text);
            _objSOBook.BookSetCode     = Convert.ToInt32(((Label)grdBooksetDetails.Rows[e.RowIndex].FindControl("lblBooksetid")).Text);
            _objSOBook.BookCode        = (((Label)grdBooksetDetails.Rows[e.RowIndex].FindControl("lblBookCode")).Text);
            _objSOBook.SellingPrice    = Convert.ToDecimal(((TextBox)grdBooksetDetails.Rows[e.RowIndex].FindControl("txtSellingprice")).Text);
            _objSOBook.OMPrice         = Convert.ToDecimal(((TextBox)grdBooksetDetails.Rows[e.RowIndex].FindControl("txtOMPrice")).Text);
            _objSOBook.Quantity        = Qty;
            _objSOBook.IsActive        = Convert.ToBoolean(false);
            _objSOBook.IsDeleted       = Convert.ToBoolean(true);
            _objSOBook.Save();

            DataTable dt1 = new DataTable();
            dt1 = (DataTable)Session["tempdata"];
            dt1.Rows[e.RowIndex].Delete();
            grdBooksetDetails.DataSource = dt1;
            grdBooksetDetails.DataBind();
            Session["tempdata"] = dt1;
        }
        catch
        {
        }
    }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null)
     {
         DataSet ds = new DataSet();
         ds = SetofBooks.GetBooksetdetails_ByBooksetID(Convert.ToInt32(Request.QueryString["d"].ToString()));
         grdBooksetDetails.DataSource = ds.Tables[0];
         grdBooksetDetails.DataBind();
         lblBookSet.Text = Request.QueryString["sd"].ToString();
     }
 }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        SetofBooks _objBookset = new SetofBooks();

        if (grdBooksetDetails.Rows.Count == 0)
        {
            // BtnSave.Visible = true;
            MessageBox("Kindly fill Details");
        }
        else
        {
            foreach (GridViewRow row in grdBooksetDetails.Rows)
            {
                _objBookset.BooksetDetailID = Convert.ToInt32(((Label)row.FindControl("lblBSDetailId")).Text);
                _objBookset.BookSetCode     = Convert.ToInt32(((Label)row.FindControl("lblBooksetid")).Text);
                _objBookset.BookCode        = (((Label)row.FindControl("lblBookCode")).Text);
                string _sp = ((TextBox)row.FindControl("txtSellingprice")).Text;
                if (_sp == string.Empty)
                {
                    _objBookset.SellingPrice = Convert.ToDecimal(0);
                }
                else
                {
                    _objBookset.SellingPrice = Convert.ToDecimal(_sp.ToString());
                }
                string _omp = ((TextBox)row.FindControl("txtOMPrice")).Text;
                if (_omp == string.Empty)
                {
                    _objBookset.OMPrice = Convert.ToDecimal(0);
                }
                else
                {
                    _objBookset.OMPrice = Convert.ToDecimal(_omp.ToString());
                }

                _objBookset.Quantity = Qty;
                _objBookset.IsActive = ChekActive.Checked;
                _objBookset.Save();
            }

            MessageBox("Your BookSet saved sucessfully.");
            Session["tempdata"] = null;
            // DDLSet.SelectedValue = null;
            DDLSet.Focus();;
            grdBooksetDetails.Visible = false;

            BtnSave.Visible = false;
            DDLSet.Items.Clear();
            BindDDL();
            DDLSet.Items.Insert(0, new ListItem("-Select book set-", "0"));
            txtbkcod.Text = "";
        }
        Session["tempdata"] = null;
    }
示例#4
0
        /// <summary>
        /// 查询主账簿的本币
        /// </summary>
        /// <param name="OrgCode">接单组织</param>
        /// <returns>本币</returns>
        public CurrencyDto GetSoBCurrency(string OrgCode)
        {
            Organization Org = Organization.Finder.Find("Code=@Code", new OqlParam(OrgCode));

            if (Org != null)
            {
                Currency.Org      = Org.ID;
                Currency.Org_Code = Org.Code;
                Currency.Org_Name = Org.Name;
                SetofBooks SOB = SetofBooks.Finder.Find("Org=@Org and SOBType=@SOBType ", new OqlParam(Org.ID), new OqlParam(UFIDA.U9.Base.SOB.SOBTypeEnum.PrimarySOB.Value));//and Effective=@Effective new OqlParam(UFIDA.U9.Base.PropertyTypes.Effective.EntityRes.IsEffective)
                if (SOB != null)
                {
                    if (SOB.FunctionalCurrency != null)
                    {
                        Currency.CurrencyID   = SOB.FunctionalCurrency.ID;
                        Currency.CurrencyCode = SOB.FunctionalCurrency.Code;
                        Currency.CurrencyName = SOB.FunctionalCurrency.Name;
                    }
                }
            }
            return(Currency);
        }
    public DataTable fillTempBookData(string bookcode, string flag)
    {
        DataTable dt          = new DataTable();
        DataTable tempGetData = new DataTable();

        if (Session["tempdata"] == null)
        {
            dt.Columns.Add("BookSetDetailId");
            dt.Columns.Add("BookSet");
            dt.Columns.Add("BooksetID");
            dt.Columns.Add("BookCode");
            dt.Columns.Add("BookName");
            dt.Columns.Add("Quantity");
            dt.Columns.Add("SellingPrice");
            dt.Columns.Add("OMPrice");
            dt.Columns.Add("Standard");
        }
        else
        {
            dt = (DataTable)Session["tempdata"];
        }

        if (flag == "set")
        {
            tempGetData = SetofBooks.GetBooksetdetails_ByBooksetID(Convert.ToInt32(DDLSet.SelectedItem.Value)).Tables[0];
        }
        else
        {
            tempGetData = Books.Get_BooksMaster(bookcode).Tables[0];

            tempGetData.Columns.Add("BookSetDetailId").DefaultValue = 0;
        }
        foreach (DataRow row in tempGetData.Rows)
        {
            if (dt.Rows.Count != 0)
            {
                DataView dv = new DataView(dt);
                dv.RowFilter = "BookCode = '" + row["BookCode"].ToString() + "'";
                int i = 0;
                foreach (DataRowView row1 in dv)
                {
                    i++;
                }
                if (i == 0)
                {
                    if (row["BookSetDetailId"].ToString() == "")
                    {
                        dt.Rows.Add("0", DDLSet.SelectedItem.Text.ToString(), DDLSet.SelectedItem.Value.ToString(), row["BookCode"].ToString(), row["BookName"].ToString(), "1", string.Format("{0:0.00}", Convert.ToDecimal(row["SellingPrice"].ToString())), string.Format("{0:0.00}", Convert.ToDecimal(row["OMPrice"].ToString())), row["Standard"].ToString());
                    }
                    else
                    {
                        dt.Rows.Add(row["BookSetDetailId"], DDLSet.SelectedItem.Text.ToString(), DDLSet.SelectedItem.Value.ToString(), row["BookCode"].ToString(), row["BookName"].ToString(), "1", string.Format("{0:0.00}", Convert.ToDecimal(row["SellingPrice"].ToString())), string.Format("{0:0.00}", Convert.ToDecimal(row["OMPrice"].ToString())), row["Standard"].ToString());
                    }
                }
            }
            else
            {
                if (row["BookSetDetailId"].ToString() == "")
                {
                    dt.Rows.Add("0", DDLSet.SelectedItem.Text.ToString(), DDLSet.SelectedItem.Value.ToString(), row["BookCode"].ToString(), row["BookName"].ToString(), "1", string.Format("{0:0.00}", Convert.ToDecimal(row["SellingPrice"].ToString())), string.Format("{0:0.00}", Convert.ToDecimal(row["OMPrice"].ToString())), row["Standard"].ToString());
                }
                else
                {
                    dt.Rows.Add(row["BookSetDetailId"], DDLSet.SelectedItem.Text.ToString(), DDLSet.SelectedItem.Value.ToString(), row["BookCode"].ToString(), row["BookName"].ToString(), "1", string.Format("{0:0.00}", Convert.ToDecimal(row["SellingPrice"].ToString())), string.Format("{0:0.00}", Convert.ToDecimal(row["OMPrice"].ToString())), row["Standard"].ToString());
                }
            }
        }

        return(dt);
    }