Exemplo n.º 1
0
        protected void btnAdd_Click(Object Sender, EventArgs e)
        {
            if (hdnLocation.Value == "")
            {
                hdnLocation.Value = "0";
            }

            if (Request.Form[hdnId.UniqueID] == "0")
            {
                oDepot.Add(txtName.Text, Int32.Parse(hdnLocation.Value), (chkEnabled.Checked ? 1 : 0));
            }
            else
            {
                oDepot.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, Int32.Parse(hdnLocation.Value), (chkEnabled.Checked ? 1 : 0));
            }
            if (Request.Form[hdnOrder.UniqueID] != "")
            {
                string strOrder = Request.Form[hdnOrder.UniqueID];
                int    intCount = 0;
                while (strOrder != "")
                {
                    intCount++;
                    int intId = Int32.Parse(strOrder.Substring(0, strOrder.IndexOf("&")));
                    strOrder = strOrder.Substring(strOrder.IndexOf("&") + 1);
                    oDepot.UpdateOrder(intId, intCount);
                }
            }
            Response.Redirect(Request.Path);
        }
Exemplo n.º 2
0
        protected int GetDepot(string _name)
        {
            if (_name.Trim() == "")
            {
                return(0);
            }
            DataSet ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_depot WHERE name = '" + _name + "' AND enabled = 1 AND deleted = 0");

            if (ds.Tables[0].Rows.Count == 0)
            {
                Depot oDepot = new Depot(intProfile, dsn);
                oDepot.Add(_name, 1);
                sb.Append("<tr><td>-</td><td>Add Depot ");
                sb.Append(_name);
                sb.Append("</td></tr>");
                return(GetDepot(_name));
            }
            else
            {
                return(Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()));
            }
        }