Exemple #1
0
        protected void dgnews_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "edititem")
            {
                blank();
                hidid.Value  = e.CommandArgument.ToString();
                objAsset.nid = hidid.Value;
                //assetId = objAsset.nid;
                objAsset.companyId = Session["companyid"].ToString();
                objAsset.action    = "select";
                ds = objAsset.trasferAssets();
                ddlasset.Disabled      = true;
                hidasset.Value         = ds.Tables[0].Rows[0]["assetid"].ToString();
                ddlasset.Value         = ds.Tables[0].Rows[0]["asset"].ToString();
                hidtransfer_date.Value = ds.Tables[0].Rows[0]["preTransDate"].ToString();
                if (ds.Tables[0].Rows[0]["duedate1"].ToString() == "" && ds.Tables[0].Rows[0]["duedate1"] == null)
                {
                    txtDueDate.Text = "";
                }
                else
                {
                    txtDueDate.Text = ds.Tables[0].Rows[0]["duedate1"].ToString();
                }
                dropTransferTo.SelectedValue = ds.Tables[0].Rows[0]["transferTo"].ToString();

                if (ds.Tables[0].Rows[0]["transferTo"].ToString() == "Individual")
                {
                    employee_div_display.Style.Add("display", "block");
                    drop_employeName.Text = ds.Tables[0].Rows[0]["transferToID"].ToString();
                }
                else if (ds.Tables[0].Rows[0]["transferTo"].ToString() == "Repair")
                {
                    vendor_div_display.Style.Add("display", "block"); drop_vendorName.Text = ds.Tables[0].Rows[0]["transferToID"].ToString();
                }

                drop_departmentName.SelectedValue = ds.Tables[0].Rows[0]["deptid"].ToString();
                txt_Notes.Text        = ds.Tables[0].Rows[0]["notes"].ToString();
                txt_TransferDate.Text = ds.Tables[0].Rows[0]["transferDate"].ToString();
                btnsubmit.Text        = "Update";
                ScriptManager.RegisterStartupScript(this, GetType(), "key", "<script type='text/javascript'>opendiv();</script>", false);
                updatePanelAssign.Update();
            }

            if (e.CommandName == "del")
            {
                objAsset.nid    = e.CommandArgument.ToString();
                objAsset.action = "delete";
                objAsset.trasferAssets();
                fillgrid();
            }
        }
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            clsObject.nid          = "";
            clsObject.action       = "insert";
            clsObject.AssetId      = assetId;
            clsObject.cLocation    = cLocation;
            clsObject.cLocationId  = cLocationId;
            clsObject.transferTo   = dropTransferTo.SelectedValue;
            clsObject.transferBy   = Session["userid"].ToString();
            clsObject.transferDate = txt_TransferDate.Text;
            clsObject.dueDate      = txtDueDate.Text;
            clsObject.Notes        = txt_Notes.Text;

            /*The switch statement below fills in the selected dropdown value in the tranferToID variable of clsObject*/
            switch (dropTransferTo.SelectedValue)
            {
            case "Individual":
            {
                clsObject.transferToID = drop_departmentName.SelectedValue;
                break;
            }

            case "Repair":
            {
                clsObject.transferToID = drop_vendorName.SelectedValue; break;
            }

            case "Stock":
            {
                clsObject.transferToID = dropTransferTo.SelectedValue;
                break;
            }

            case "Store":
            {
                clsObject.transferToID = dropTransferTo.SelectedValue;
                break;
            }

            case "Inuse":
            {
                clsObject.transferToID = dropTransferTo.SelectedValue;
                break;
            }

            default: { Console.WriteLine("check if data select in drop_transferTo combo is correct"); break; }
            }
            clsObject.companyId = Session["companyid"].ToString();
            clsObject.trasferAssets();
            blank();
            GeneralMethod.alert(this.Page, "Saved Successfully!");
        }
        public static string getImagesPath(string assetId)
        {
            StringBuilder sb       = new StringBuilder();
            Cls_Asset     objAsset = new Cls_Asset();
            DataSet       ds       = new DataSet();
            GeneralMethod objgen   = new GeneralMethod();

            objAsset.AssetId = assetId;
            //  objAsset.companyId = Session["companyid"].ToString();
            objAsset.action = "selectforhistory";
            ds = objAsset.trasferAssets();
            sb.Append('{');

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                switch (ds.Tables[0].Rows[i]["transferTo"].ToString())
                {
                case "Individual":
                {
                    if (ds.Tables[0].Rows[i]["imgurl"].ToString() != "")
                    {
                        sb.Append("\"pathImage" + i + "\"" + ":\"" + "webfile//profile//thumb//" + ds.Tables[0].Rows[i]["imgurl"].ToString() + "@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    }
                    else
                    {
                        sb.Append("\"pathImage" + i + "\"" + ":\"images//" + "Individualss.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    }
                    break;
                }

                case "Stock":
                {
                    sb.Append("\"pathImage" + i + "\"" + ":\"images//" + "Stocks.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    break;
                }

                case "Store":
                {
                    sb.Append("\"pathImage" + i + "\"" + ":\"images//" + "Stores.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    break;
                }

                case "Inuse":
                {
                    sb.Append("\"pathImage" + i + "\"" + ":\"images//" + "InUses.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    break;
                }

                case "Repair":
                {
                    sb.Append("\"pathImage" + i + "\"" + ":\"images//" + "Repairs.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    break;
                }
                }
                if (i != ds.Tables[0].Rows.Count - 1)
                {
                    sb.Append(',');
                    sb.Append("\"pathImage" + i + 0 + 0 + "\"" + ":\"images//" + "arrows.png@" + ds.Tables[0].Rows[i]["transferdate"].ToString() + "@" + ds.Tables[0].Rows[i]["Location"].ToString() + "\"");
                    sb.Append(',');
                }
            }
            sb.Append('}');
            return(sb.ToString());
        }
Exemple #4
0
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            clsObject.nid = hidid.Value;
            if (hidid.Value != "")
            {
                clsObject.action = "insert";
            }
            else
            {
                if (AsssetTransfer_isapprove.Value == "1")
                {
                    clsObject.action = "insert";
                }
                else
                {
                    clsObject.action = "insertrequest";
                }
            }
            //if (Convert.ToDateTime(hidtransfer_date.Value) > Convert.ToDateTime(txt_TransferDate.Text)) {
            //    GeneralMethod.alert(this.Page, "You cannot transfer befor last transere date !");
            //    return;
            //}
            clsObject.AssetId = hidasset.Value;

            clsObject.cLocationId  = hidlocationid.Value;
            clsObject.transferTo   = dropTransferTo.SelectedValue;
            clsObject.transferBy   = Session["userid"].ToString();
            clsObject.transferDate = txt_TransferDate.Text;
            if (string.IsNullOrEmpty(txtDueDate.Text))
            {
                // clsObject.dueDate = DBNull.Value.ToString();
            }
            else
            {
                clsObject.dueDate = txtDueDate.Text;
            }
            clsObject.Notes      = txt_Notes.Text;
            clsObject.recType    = "transfer";
            clsObject.department = drop_departmentName.Text;

            /*The switch statement below fills in the selected dropdown value in the tranferToID variable of clsObject*/
            switch (dropTransferTo.SelectedValue)
            {
            case "Individual":
            {
                clsObject.transferToID = drop_employeName.Text;
                break;
            }

            case "Repair":
            {
                clsObject.transferToID = drop_vendorName.Text; break;
            }

            default: { clsObject.transferToID = ""; break; }
            }
            clsObject.companyId = Session["companyid"].ToString();
            clsObject.trasferAssets();
            blank();
            fillgrid();
            GeneralMethod.alert(this.Page, "Saved Successfully!");
        }