protected void OK_SUBMIT_Click(object sender, EventArgs e)
        {
            SqlConnection  conn = new SqlConnection(GlobalClass.SQLConnString());
            DataTable      dt   = new DataTable();
            SqlCommand     cmd  = null;
            SqlDataAdapter adp;
            DataTable      dt1  = new DataTable();
            SqlCommand     cmd1 = null;
            SqlDataAdapter adp1;

            ponumber = gridCreatedPO.GetRowValues(gridCreatedPO.FocusedRowIndex, "PONumber").ToString();

            string qry = "SELECT tbl_POCreation_Details.* FROM tbl_POCreation_Details WHERE (PONumber = '" + ponumber + "')";

            cmd            = new SqlCommand(qry);
            cmd.Connection = conn;
            adp            = new SqlDataAdapter(cmd);
            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (row["TaxGroup"].ToString().Trim() == "")
                    {
                        ModalPopupExtenderLoading.Hide();
                        POListNotify.HeaderText     = "Error...";
                        POListNotifyLbl.Text        = "Details has no Tax Group.";
                        POListNotify.ShowOnPageLoad = true;
                        return;
                    }
                    if (row["TaxItemGroup"].ToString().Trim() == "")
                    {
                        ModalPopupExtenderLoading.Hide();
                        POListNotify.HeaderText     = "Error...";
                        POListNotifyLbl.Text        = "Details has no Tax Item Group.";
                        POListNotify.ShowOnPageLoad = true;
                        return;
                    }
                }
            }
            else
            {
                ModalPopupExtenderLoading.Hide();
                POListNotify.HeaderText     = "Error...";
                POListNotifyLbl.Text        = "No Data to submit.";
                POListNotify.ShowOnPageLoad = true;
                return;
            }
            dt.Clear();
            conn.Close();

            //Submit_Method();

            //POClass.SubmitToAX(ponumber, POListNotify, POListNotifyLbl, ModalPopupExtenderLoading);

            POClass.SubmitToAXTable(ponumber, Session["UserCompleteName"].ToString(), POListNotify, POListNotifyLbl, ModalPopupExtenderLoading);


            Bind_PO_List();
        }
예제 #2
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            bool         cancel = false;
            ASPxGridView grid   = POAddEditGrid as ASPxGridView;

            for (int i = 0; i < grid.VisibleRowCount; i++)
            {
                object taxgroup     = grid.GetRowValues(i, "TaxGroup");
                object taxitemgroup = grid.GetRowValues(i, "TaxItemGroup");
                object identifier   = grid.GetRowValues(i, "Identifier");
                object cip          = grid.GetRowValues(i, "CapexCIP");
                object prodcat      = grid.GetRowValues(i, "ProdCat");

                if (string.IsNullOrEmpty(taxgroup.ToString()) || string.IsNullOrEmpty(taxitemgroup.ToString()))
                {
                    cancel = true;
                    break;
                }

                if (identifier.ToString() == "4")
                {
                    MRPClass.PrintString(prodcat.ToString());
                    MRPClass.PrintString(string.IsNullOrEmpty(cip.ToString()).ToString());
                    if (prodcat.ToString() != "CIP")
                    {
                        if (string.IsNullOrEmpty(cip.ToString()))
                        {
                            cancel = true;
                            break;
                        }
                    }
                }
            }
            if (cancel)//if empty taxgroup this is true
            {
                ModalPopupExtenderLoading.Hide();
                PONotify.HeaderText     = "Alert";
                PONotifyLbl.Text        = "Some selected items are empty.";
                PONotify.ShowOnPageLoad = true;
            }
            else
            {
                if (grid.VisibleRowCount > 0)
                {
                    //Submit_Method();
                    //POClass.SubmitToAX(ponumber, PONotify, PONotifyLbl, ModalPopupExtenderLoading);

                    POClass.SubmitToAXTable(ponumber, Session["UserCompleteName"].ToString(), PONotify, PONotifyLbl, ModalPopupExtenderLoading);
                }

                else
                {
                    ModalPopupExtenderLoading.Hide();

                    Submit.ClientEnabled    = false;
                    PONotify.HeaderText     = "Alert";
                    PONotifyLbl.Text        = "No data to submit";
                    PONotify.ShowOnPageLoad = true;
                }
            }

            ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);
            BindData();
        }