protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            //validation
            if (DdlProduct.Text == "-1")
            {
                lblmsg.Text = "Select product name"; return;
            }

            if (lblmsg3.Text == "0")
            {
                lblmsg.Text = "Product is not available for issue"; return;
            }
            if (TxtQty.Text.Length <= 0)
            {
                lblmsg.Text = "Enter issue quanity"; return;
            }

            if (objValidation.IsNumeric(TxtQty.Text) == false)
            {
                lblmsg.Text = "Enter issue quanity"; return;
            }
            if (int.Parse(TxtQty.Text) > int.Parse(lblmsg3.Text))
            {
                lblmsg.Text = "Issue quanity can not be more than available qty."; return;
            }

            if (TxtTo.Text.Length <= 0)
            {
                lblmsg.Text = "Enter issue to"; return;
            }


            string strqr = "insert into IssueStock (IssueDate,IssueProductID,IssueQuantity,IssueTo,IssueBy) values (getdate()," + DdlProduct.Text + "," + TxtQty.Text + ",'" + TxtTo.Text.Replace("'", "''") + "'," + Convert.ToString(Session["UserID"]) + ")";


            string ret = objDb.ExecuteInsertUpdate(strqr);
            if (ret == "" || ret == null || ret == "0")
            {
                lblmsg.Text = "Error : " + objDb.returnMsg; return;
            }

            this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script language=\"javaScript\">" + "alert('Stock Issued');" + "window.location.href='default.aspx';" + "<" + "/script>");
        }
        catch (Exception ex)
        {
            lblmsg.Text = "Error : " + ex.Message.ToString();
        }
    }
示例#2
0
    protected void BtnAddProduct_Click(object sender, EventArgs e)
    {
        //validation
        if (DdlProduct.Text == "-1")
        {
            lblmsg.Text = "Select product"; return;
        }
        if (DdlWarehouse.Text == "--1")
        {
            lblmsg.Text = "Select warehouse"; return;
        }
        if (TxtQuantity.Text.Trim().Length <= 0)
        {
            lblmsg.Text = "Enter quantity"; return;
        }
        if (objValidation.IsNumeric(TxtQuantity.Text) == false)
        {
            lblmsg.Text = "Enter quantity"; return;
        }
        //add in datatable and re-bind grid
        dt = (DataTable)ViewState["dt"];
        if (dt.Rows.Count == 1)
        {
            if (Convert.ToString(dt.Rows[0][0]) == "")
            {
                dt.Rows[0].Delete();
            }
        }

        DataRow r1;

        r1    = dt.NewRow();
        r1[0] = dt.Rows.Count + 1;
        r1[1] = DdlProduct.Text + "-" + objDb.ExecuteScaler("select ProductName from productmaster where productid=" + DdlProduct.Text);
        r1[2] = DdlWarehouse.Text + "-" + objDb.ExecuteScaler("select WarehouseName from WarehouseMaster where WarehouseID=" + DdlWarehouse.Text);
        r1[3] = TxtQuantity.Text;
        r1[4] = objDb.ExecuteScaler("select Price from productmaster where productid=" + DdlProduct.Text);
        dt.Rows.Add(r1);

        ViewState["dt"] = dt;
        Session["dt"]   = dt;
        grv1.DataSource = dt;
        grv1.DataBind();

        dt = (DataTable)ViewState["dt"];
        //Response.Write(dt.Rows.Count);
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        //validate data
        try
        {
            if (TxtDisplayName.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter name."; return;
            }
            if (objValidation.IsValideCharacter(TxtDisplayName.Text) == false)
            {
                lblmsg.Text = "Special characters not allowed in name."; return;
            }
            if (TxtMobile.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter mobile no."; return;
            }
            if (objValidation.IsNumeric(TxtMobile.Text) == false)
            {
                lblmsg.Text = "Only enter numbers in mobile no."; return;
            }

            if (TxtWebsite.Text.Length > 0)
            {
                if (Uri.IsWellFormedUriString(TxtWebsite.Text, UriKind.Absolute) == false)
                {
                    lblmsg.Text = "Invalid web site url."; return;
                }
            }
            //update user profile
            string strqry = "";
            strqry = "update usermaster set displayname='" + TxtDisplayName.Text.Replace("'", "''") + "', mobileno='" + TxtMobile.Text + "',officeno='" + TxtOfficeNo.Text.Replace("'", "''") + "', Extension='" + TxtExt.Text.Replace("'", "''") + "', Address='" + TxtAddress.Text.Replace("'", "''") + "',website='" + TxtWebsite.Text.Replace("'", "''") + "' where emailid = '" + Convert.ToString(Session["EmailID"]) + "'";
            string ret = objDb.ExecuteInsertUpdate(strqry);
            if (ret == "" || ret == null || ret == "0")
            {
                lblmsg.Text = "Error : " + objDb.returnMsg; return;
            }
            lblmsg.Text = "User profile updated successfully!.";
        }
        catch (Exception ex)
        {
            lblmsg.Text = "Error : " + ex.Message.ToString();
        }
    }
示例#4
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            //validation
            if (TxtProductName.Text.Length <= 0)
            {
                lblmsg.Text = "Enter product name. "; return;
            }
            string strcount = objDb.ExecuteScaler("select count(*) from ProductMaster where ProductName='" + TxtProductName.Text + "' and ProductCompanyID=" + Convert.ToString(Session["UserID"]));

            if (DdlCategory.Text == "-1")
            {
                lblmsg.Text = "Select category. "; return;
            }

            if (objValidation.IsNumeric(TxtPrice.Text) == false)
            {
                lblmsg.Text = "Enter product price. "; return;
            }


            string strqr = "";
            if (Request.QueryString.Count > 0)
            {
                if (int.Parse(strcount) > 1)
                {
                    lblmsg.Text = "Duplicate product name are not allowed.";

                    TxtProductName.Focus();
                    return;
                }

                strqr = "update ProductMaster set ProductName='" + TxtProductName.Text.Replace("'", "''") + "',ProductDescription='" + TxtDescription.Text.Replace("'", "''") + "', ProductCatId=" + DdlCategory.SelectedItem.Value + ", Price=" + TxtPrice.Text + " where ProductID=" + Convert.ToString(Request.QueryString["id"]);
            }
            else
            {
                if (int.Parse(strcount) >= 1)
                {
                    lblmsg.Text = "Duplicate product name are not allowed.";

                    TxtProductName.Focus();
                    return;
                }

                strqr = "insert into ProductMaster (ProductName,ProductDescription,ProductCatId,ProductCompanyID,Price) values ('" + TxtProductName.Text.Replace("'", "''") + "','" + TxtDescription.Text.Replace("'", "''") + "'," + DdlCategory.SelectedItem.Value + "," + Convert.ToString(Session["UserID"]) + "," + TxtPrice.Text + ")";
            }
            string ret = objDb.ExecuteInsertUpdate(strqr);
            if (ret == "" || ret == null || ret == "0")
            {
                lblmsg.Text = "Error : " + objDb.returnMsg; return;
            }
            this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script language=\"javaScript\">" + "alert('Record saved successfully!');" + "window.location.href='ProductMaster.aspx';" + "<" + "/script>");

            //Response.Redirect("ProductMaster.aspx");
        }
        catch (Exception ex)
        {
            lblmsg.Text = "Error : " + ex.Message.ToString();
        }
    }
示例#5
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        lblmsg.Text = "";
        try
        {
            // Validation Area
            if (TxtEmailID.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter email id."; return;
            }
            if (objValidation.IsEmail(TxtEmailID.Text) == false)
            {
                lblmsg.Text = "Email id you have entered not in correct format."; return;
            }

            if (TxtEmailID.Text.Trim() != "")
            {
                string str = objDb.ExecuteScaler("select count(*) from usermaster where emailid='" + TxtEmailID.Text + "'");
                if (str != "" && str != null && str != "0")
                {
                    lblmsg.Text     = "Email id already registered, please enter other email id.";
                    TxtEmailID.Text = "";
                    TxtEmailID.Focus();
                }
            }

            if (TxtPassword.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter password."; return;
            }
            if (TxtPassword.Text != TxtPassword1.Text)
            {
                lblmsg.Text = "Passwords are not matched, please check."; return;
            }
            if (TxtDisplayName.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter name."; return;
            }
            if (objValidation.IsValideCharacter(TxtDisplayName.Text) == false)
            {
                lblmsg.Text = "Special characters not allowed in name."; return;
            }
            if (TxtMobile.Text.Trim() == "")
            {
                lblmsg.Text = "Please enter mobile no."; return;
            }
            if (objValidation.IsNumeric(TxtMobile.Text) == false)
            {
                lblmsg.Text = "Only enter numbers in mobile no."; return;
            }
            if (TxtWebsite.Text.Length > 0)
            {
                if (Uri.IsWellFormedUriString(TxtWebsite.Text, UriKind.RelativeOrAbsolute) == false)
                {
                    lblmsg.Text = "Invalid web site url."; return;
                }
            }
            //------------------



            string strInsert = "Insert into usermaster (EmailID, TypeID,DisplayName,Password,MobileNo,OfficeNo,Extension,Address,Website,JoinDate,LastLoginDate,ChangePasswordDate,Active) " +
                               "values ('" + TxtEmailID.Text + "'," + ddlUserType.SelectedItem.Value + ",'" + TxtDisplayName.Text.Replace("'", "''") + "','" + TxtPassword.Text + "','" + TxtMobile.Text.Replace("'", "''") + "','" + TxtOfficeNo.Text.Replace("'", "''") + "','" + TxtExt.Text.Replace("'", "''") +
                               "','" + TxtAddress.Text.Replace("'", "''") + "','" + TxtWebsite.Text.Replace("'", "''") + "',getdate(),null,null,1)";

            strInsert = objDb.ExecuteInsertUpdate(strInsert);
            if (strInsert == "" || strInsert == null || strInsert == "0")
            {
                lblmsg.Text = "Error : " + objDb.returnMsg; return;
            }
            this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script language=\"javaScript\">" + "alert('User registration done successfully!, please login!');" + "window.location.href='login.aspx';" + "<" + "/script>");


            //lblmsg.Text = "User registration done successfully!.";
            //btnreset_Click(null, null);
        }
        catch (Exception ex) {
            lblmsg.Text = "Error in Submit : " + ex.Message.ToString();
        }
    }