public void FillTransferRequestgrid()
    {
        DataTable dt = new DataView(ObjTransReq.GetAllRecord_TrueByRequestLocation(strCompId.ToString(), StrBrandId.ToString(), StrLocId.ToString(), "0"), "Post='Y' and RequestLocationId='" + StrLocId.ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();

        dt.Columns.Add("Location_Name");


        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataTable Dtlocation = objLocation.GetLocationMasterById(strCompId, dt.Rows[i]["Location_ID"].ToString());
            dt.Rows[i]["Location_Name"] = Dtlocation.Rows[0]["Location_Name"].ToString();
        }
        gvTransferRequest.DataSource = dt;
        gvTransferRequest.DataBind();

        Session["DtTransferRequestFilter"] = dt;
        AllPageCode();
    }
    protected void btnEdit_Command(object sender, CommandEventArgs e)
    {
        DataTable dt = ObjTrans.GetRecordUsingTransId(StrCompId.ToString(), StrBrandId.ToString(), StrLocationId.ToString(), e.CommandArgument.ToString());

        if (dt.Rows.Count != 0)
        {
            if (dt.Rows[0]["Status"].ToString() != "0")
            {
                DisplayMessage("Transfer Request in use,can not be Update");
                return;
            }
            editid.Value       = e.CommandArgument.ToString();
            txtlRequestNo.Text = dt.Rows[0]["RequestNo"].ToString();
            DataTable dtlocation = objLocation.GetLocationMasterById(StrCompId, dt.Rows[0]["RequestLocationID"].ToString());



            txtRequestdate.Text   = Convert.ToDateTime(dt.Rows[0]["TDate"].ToString()).ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString());
            txtTermCondition.Text = dt.Rows[0]["Remark"].ToString();
            txtLocationName.Text  = dtlocation.Rows[0]["Location_Name"].ToString();
            string Post = dt.Rows[0]["Post"].ToString();
            if (Post.Trim() == "Y")
            {
                ChkPost.Checked = true;
                ChkPost.Enabled = false;
            }
            else
            {
                ChkPost.Checked = false;
                ChkPost.Enabled = true;
            }
            fillgridDetail();
            btnNew_Click(null, null);
            btnNew.Text = Resources.Attendance.Edit;
        }
    }
Example #3
0
    protected void btnEdit_Command(object sender, CommandEventArgs e)
    {
        DataTable dTranfer = ObjTransferHeader.GetTransferHeaderForTransferIn(strCompId, StrBrandId, StrLocId);

        dTranfer = new DataView(dTranfer, "Trans_Id=" + e.CommandArgument.ToString() + "", "", DataViewRowState.CurrentRows).ToTable();
        if (dTranfer.Rows.Count != 0)
        {
            editid.Value         = e.CommandArgument.ToString();
            txtTransferDate.Text = Convert.ToDateTime(dTranfer.Rows[0]["TDate"].ToString()).ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString());
            txtVoucherNo.Text    = dTranfer.Rows[0]["VoucherNo"].ToString();


            DataTable dtTranReqHeader = ObjTransReq.GetRecordUsingTransId(strCompId.ToString(), StrBrandId.ToString(), StrLocId.ToString(), dTranfer.Rows[0]["RequestNo"].ToString());
            if (dtTranReqHeader.Rows.Count != 0)
            {
                ViewState["RequestId"] = dTranfer.Rows[0]["RequestNo"].ToString();
                pnlTrans.Visible       = true;
                txtTransReqDate.Text   = Convert.ToDateTime(dtTranReqHeader.Rows[0]["TDate"].ToString()).ToString(ObjSysParam.GetSysParameterByParamName("Date_Format").Rows[0]["Param_Value"].ToString());
                txtTransNo.Text        = dtTranReqHeader.Rows[0]["RequestNo"].ToString();

                try
                {
                    txtLocationName.ReadOnly = true;
                    txtLocationName.Text     = objLocation.GetLocationMasterById(strCompId, dTranfer.Rows[0]["FromLocationId"].ToString()).Rows[0]["Location_Name"].ToString();
                }
                catch
                {
                    txtLocationName.Text = "";
                }

                DataTable dtTrasDetail = ObjTransferDetail.GetTransferDetailbyTransferId(strCompId.ToString(), StrBrandId.ToString(), dTranfer.Rows[0]["FromLocationId"].ToString(), e.CommandArgument.ToString());
                if (dtTrasDetail.Rows.Count > 0)
                {
                    gvEditProduct.DataSource = dtTrasDetail;
                    gvEditProduct.DataBind();
                    btnNew_Click(null, null);
                    btnNew.Text = Resources.Attendance.Edit;
                }
            }
        }
    }