コード例 #1
0
    protected void ReportGridDtls_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int DeleteId = 0;

        try
        {
            DeleteId = Convert.ToInt32(((ImageButton)ReportGridDtls.Rows[e.RowIndex].Cells[0].FindControl("ImgBtnDelete")).CommandArgument.ToString());
            if (DeleteId != 0)
            {
                Entity_damage.ReturnId  = DeleteId;
                Entity_damage.UserID    = Convert.ToInt32(Session["UserID"]);
                Entity_damage.LoginDate = DateTime.Now;

                int iDelete = Obj_damage.DeleteRecord(ref Entity_damage, out StrError);
                if (iDelete != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                    MakeEmptyForm();
                }
            }
            Entity_damage = null;
            Obj_damage    = null;
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
コード例 #2
0
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        DMReturn obj_Damage = new DMReturn();

        String[] SearchList = obj_Damage.GetSuggestedRecord(prefixText);
        return(SearchList);
    }
コード例 #3
0
    protected void ReportGridDtls_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Select"):
            {
                if (Convert.ToInt32(e.CommandArgument) != 0)
                {
                    ViewState["EditId"] = Convert.ToInt32(e.CommandArgument);
                    DS = Obj_damage.GetRecordForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        TxtReturnNo.Text   = DS.Tables[0].Rows[0]["ReturnNo"].ToString();
                        lblReturndate.Text = DS.Tables[0].Rows[0]["ReturnDate"].ToString();
                        lblPreparedBy.Text = DS.Tables[0].Rows[0]["UserName"].ToString();        // Session["UserName"].ToString();
                        lblInwardNo.Text   = DS.Tables[0].Rows[0]["InwardNo"].ToString();
                        lblInwardDate.Text = DS.Tables[0].Rows[0]["InwardDate"].ToString();
                        lblSuppName.Text   = DS.Tables[0].Rows[0]["SuplierName"].ToString();

                        lblpono.Text          = DS.Tables[0].Rows[0]["PONo"].ToString();
                        lblPODATE.Text        = DS.Tables[0].Rows[0]["PODate"].ToString();
                        lblQuotationNo.Text   = DS.Tables[0].Rows[0]["POQTNO"].ToString();
                        lblQuotationDate.Text = DS.Tables[0].Rows[0]["POQTDATE"].ToString();
                        ddlInwardNo.Enabled   = false;
                    }
                    else
                    {
                        MakeEmptyForm();
                    }
                    if (DS.Tables[1].Rows.Count > 0)
                    {
                        FlagForCalculationOperation = true;
                        GrdInward.DataSource        = DS.Tables[1];
                        GrdInward.DataBind();
                        ViewState["CurrentTable"] = DS.Tables[1];
                        ViewState["ReturnDtls"]   = DS.Tables[1];
                    }
                    DS                = null;
                    Obj_damage        = null;
                    BtnUpdate.Visible = true;
                    BtnSave.Visible   = false;
                }
                break;
            }
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
コード例 #4
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0, UpdateRowDtls = 0;

        try
        {
            CheckQty();
            if (chkflag == false)
            {
                if (ViewState["EditId"] != null)
                {
                    Entity_damage.ReturnId = Convert.ToInt32(ViewState["EditId"]);
                }
                Entity_damage.PreparedBy = Convert.ToInt32(Session["UserID"]);
                Entity_damage.UserID     = Convert.ToInt32(Session["UserId"]);
                Entity_damage.LoginDate  = DateTime.Now;
                if (chkReturnDebitNote.Checked)
                {
                    Entity_damage.IsDebitNote = 1;
                }
                else
                {
                    Entity_damage.IsDebitNote = 0;
                }
                UpdateRow = Obj_damage.UpdateRecord(ref Entity_damage, out StrError);
                if (UpdateRow > 0)
                {
                    if (ViewState["CurrentTable"] != null)
                    {
                        for (int i = 0; i < GrdInward.Rows.Count; i++)
                        {
                            if (((TextBox)GrdInward.Rows[i].FindControl("GrdtxtReturnQty")).Text != "0" && ((TextBox)GrdInward.Rows[i].FindControl("GrdtxtReturnQty")).Text != String.Empty)
                            {
                                Entity_damage.ReturnId      = Convert.ToInt32(ViewState["EditId"]);
                                Entity_damage.ItemId        = Convert.ToInt32(GrdInward.Rows[i].Cells[2].Text.ToString());
                                Entity_damage.InwardQty     = Convert.ToDecimal(GrdInward.Rows[i].Cells[8].Text.ToString());
                                Entity_damage.DamageQty     = Convert.ToDecimal(GrdInward.Rows[i].Cells[9].Text.ToString());
                                Entity_damage.PrevReturnQty = Convert.ToDecimal(GrdInward.Rows[i].Cells[10].Text.ToString());
                                if (((TextBox)GrdInward.Rows[i].FindControl("GrdtxtReturnQty")).Text == " " || string.IsNullOrEmpty(((TextBox)GrdInward.Rows[i].FindControl("GrdtxtReturnQty")).Text))
                                {
                                    Entity_damage.ReturnQty = 0;
                                }
                                else
                                {
                                    Entity_damage.ReturnQty = Convert.ToDecimal(((TextBox)GrdInward.Rows[i].FindControl("GrdtxtReturnQty")).Text);
                                }
                                Entity_damage.InwardRate = Convert.ToDecimal(GrdInward.Rows[i].Cells[12].Text.ToString());
                                Entity_damage.Reason     = (((TextBox)GrdInward.Rows[i].FindControl("TxtReason")).Text);

                                //StockDetails
                                Entity_damage.ItemDesc        = Convert.ToString(GrdInward.Rows[i].Cells[5].Text.ToString());
                                Entity_damage.StockUnitId     = Convert.ToInt32(GrdInward.Rows[i].Cells[6].Text.ToString());
                                Entity_damage.StockDate       = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                                Entity_damage.StockLocationID = Convert.ToInt32(Session["CafeteriaId"]);
                                if (chkReturnDebitNote.Checked)
                                {
                                    Entity_damage.IsDebitNote = 1;
                                }
                                else
                                {
                                    Entity_damage.IsDebitNote = 0;
                                }
                                UpdateRowDtls = Obj_damage.InsertDetailsRecord(ref Entity_damage, out StrError);
                            }
                        }
                    }
                    if (UpdateRow > 0)
                    {
                        obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                        MakeControlEmpty();
                        MakeEmptyForm();
                        Entity_damage = null;
                        Obj_damage    = null;
                    }
                }
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }