Exemplo n.º 1
0
        public ActionResult EtoSearch(string Etonumber, string projectName, string ordernumber, string customername, string gag, string doc, string routing, string orderpart, string reference)
        {
            //if (Convert.ToString(Session["username"]) != "")
            //{
            Etonumber    = Etonumber != "undefined" ? Etonumber : "";
            Etonumber    = Etonumber != "null" ? Etonumber.Replace("_", "[_]") : "";
            projectName  = projectName != "undefined" ? projectName.Replace("_", "[_]") : "";
            ordernumber  = ordernumber != "undefined" ? ordernumber.Replace("_", "[_]") : "";
            customername = customername != "undefined" ? customername.Replace("_", "[_]") : "";
            gag          = gag != "undefined" ? gag.Replace("_", "[_]") : "";
            doc          = doc != "undefined" ? doc.Replace("_", "[_]") : "";
            routing      = routing != "undefined" ? routing : "";
            orderpart    = orderpart != "undefined" ? orderpart.Replace("_", "[_]") : "";
            reference    = reference != "undefined" ? reference.Replace("_", "[_]") : "";

            var data = Mainclass.DisplayDoc("exec sp_etoSearch '" + Etonumber + "','" + projectName + "','" + ordernumber + "','" + customername + "','" + gag + "','" + doc + "','" + routing + "','" + orderpart + "','" + reference + "','" + count + "'");

            //var data = model.sp_etoSearch(Etonumber, projectName, ordernumber, customername, Vgag, Vdoc, vrouting, Vorderpart, Vref).ToList();
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);

            /*}
             * else
             *  return Json("1", JsonRequestBehavior.AllowGet);*/
        }
Exemplo n.º 2
0
        public ActionResult DocSearch(string documentNumber, string legacyPartNumber, string docStatus, string documentDescription, string LegDocumentNumber, string docType, string PartDescription)
        {
            // if (Convert.ToString(Session["username"]) != "")
            //{
            documentNumber = documentNumber != "undefined" ? documentNumber : "";

            documentNumber      = documentNumber != "null" ? documentNumber.Replace("_", "[_]") : "";
            legacyPartNumber    = legacyPartNumber != "undefined" ? legacyPartNumber.Replace("_", "[_]") : "";
            docStatus           = docStatus != "undefined" ? docStatus : "";
            documentDescription = documentDescription != "undefined" ? documentDescription.Replace("_", "[_]") : "";
            LegDocumentNumber   = LegDocumentNumber != "undefined" ? LegDocumentNumber.Replace("_", "[_]") : "";
            docType             = docType != "undefined" ? docType : "";
            PartDescription     = PartDescription != "undefined" ? PartDescription.Replace("_", "[_]") : "";

            var data = Mainclass.DisplayDoc("exec sp_docsearch '" + documentNumber + "','" + documentDescription + "','" + legacyPartNumber + "','" + docStatus + "','" + LegDocumentNumber + "','" + docType + "','" + PartDescription + "','" + count + "'");

            //var data = model.sp_docsearch(documentNumber.ToString(), documentDescription, legacyPartNumber, prtstatus, LegDocumentNumber, parttyp).ToList();
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);

            /*
             * }
             * else
             *  return Json("1", JsonRequestBehavior.AllowGet);
             */
        }
Exemplo n.º 3
0
        public ActionResult AddUser(string userEmail, string usrRole, string firstName, string lastName, string userId, string appPwd, string userTitle, string companyName, string userPhone, string userFax)
        {
            userEmail = userEmail != "undefined" ? userEmail : "";
            usrRole   = usrRole != "undefined" ? usrRole : "";
            firstName = firstName != "undefined" ? firstName : "";
            lastName  = lastName != "undefined" ? lastName : "";
            appPwd    = appPwd != "undefined" ? appPwd : "";
            //byte[] array = System.Text.Encoding.ASCII.GetBytes(appPwd);
            //appPwd = Mainclass.ByteArrayToString(array);
            userTitle   = userTitle != "undefined" ? userTitle : "";
            companyName = companyName != "undefined" ? companyName : "";
            userPhone   = userPhone != "undefined" ? userPhone : "";
            userFax     = userFax != "undefined" ? userFax : "";
            userId      = userId != "undefined" ? userId.Replace("_", "[_]") : "";

            string query = "exec [sp_adduserapp] '" + userEmail + "','" + usrRole + "','" + firstName + "','" + lastName + "','" + userId + "','" + appPwd + "','" + userTitle + "','" + companyName + "','" + userPhone + "','" + userFax + "'";
            var    data  = Mainclass.Display("exec [sp_adduserapp] '" + userEmail + "','" + usrRole + "','" + firstName + "','" + lastName + "','" + userId + "','" + appPwd + "','" + userTitle + "','" + companyName + "','" + userPhone + "','" + userFax + "'");
            /*model.sp_partsearch(Partnumber, LegPartNumer, prtstatus, dconum, LegDocNumber, parttyp).ToList();*/
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
            //}
            //else
            //    return Json("1", JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
        public ActionResult ForgetPassword(string email)
        {
            var dta = model.users.Where(a => a.email == email).FirstOrDefault();

            if (dta != null)
            {
                try
                {
                    var    pass        = "******" + Mainclass.GetString(dta.password) + "</b>";
                    string mailBody    = ConfigurationManager.AppSettings["mailBody"];
                    string mailSubject = ConfigurationManager.AppSettings["mailSubject"];
                    mailBody = string.Format(mailBody, pass, "<b>" + email + "</b>");
                    Mainclass.BuildEmail(email, mailSubject, mailBody);
                    return(Json(1, JsonRequestBehavior.AllowGet));
                }
                catch (Exception e)
                {
                    return(Json(2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
        public JsonResult LEDSearch(string liftpartNumber, string liftDocNumber, string liftPartType, string liftdesc, string Compwhereused, string liftpartStatus, string Productwhere,
                                    string hasCertification, string hasInsDoc, string tare, string wll, string tarevalue, string wllvalue, string SearchBy)
        {
            /*if (Convert.ToString(Session["username"]) != "")
             * {*/
            liftpartNumber = liftpartNumber != "undefined" ? liftpartNumber : "";
            liftpartNumber = liftpartNumber != "null" ? liftpartNumber.Replace("_", "[_]") : "";
            liftDocNumber  = liftDocNumber != "undefined" ? liftDocNumber.Replace("_", "[_]") : "";
            liftPartType   = liftPartType != "undefined" ? liftPartType : "";
            liftdesc       = liftdesc != "undefined" ? liftdesc : "";
            liftpartStatus = liftpartStatus != "undefined" ? liftpartStatus : "";

            Compwhereused    = Compwhereused != "undefined" ? Compwhereused.Replace("_", "[_]") : "";
            Productwhere     = Productwhere != "undefined" ? Productwhere.Replace("_", "[_]") : "";
            hasInsDoc        = hasInsDoc != "undefined" ? hasInsDoc : "";
            hasCertification = hasCertification != "undefined" ? hasCertification : "";
            tare             = tare != "undefined" ? tare : "";
            wll       = wll != "undefined" ? wll : "";
            wllvalue  = wllvalue != "undefined" ? wllvalue : "0.0";
            tarevalue = tarevalue != "undefined" ? tarevalue : "0.0";
            SearchBy  = SearchBy != "undefined" ? SearchBy : "";
            var data = Mainclass.Display("exec [sp_LEDSearch] @liftpartNumber = '" + liftpartNumber + "', @liftDocNumber = '" + liftDocNumber + "', @liftPartType = '" + liftPartType + "', @liftdesc = '" + liftdesc + "', @Compwhereused = '" + Compwhereused + "', @liftpartStatus = '" + liftpartStatus + "', @Productwhere = '" + Productwhere + "', @hasCertification = '" + hasCertification + "', @hasInsDoc = '" + hasInsDoc + "', @tare = '" + tare + "', @wll = '" + wll + "', @tarevalue = '" + tarevalue + "', @wllvalue = '" + wllvalue + "', @SearchBy = '" + SearchBy + "', @count = " + count + "");

            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);

            /*}
             * else
             *  return Json("1", JsonRequestBehavior.AllowGet);*/
        }
Exemplo n.º 6
0
        public ActionResult GetPartdetail(long id)
        {
            var data       = Mainclass.DisplayDoc("exec searchpartdetail " + id + "");
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Exemplo n.º 7
0
        public ActionResult Getetodetail(int id)
        {
            var data       = Mainclass.Display("DECLARE @document NVARCHAR(max) DECLARE @gadrawing NVARCHAR(max) DECLARE @routing NVARCHAR(max)  DECLARE @order NVARCHAR(max)  DECLARE @reference NVARCHAR(max)  exec [sp_etodetail] " + id + ", @document OUTPUT, @gadrawing OUTPUT, @routing OUTPUT , @order OUTPUT , @reference OUTPUT select  @document as document, @gadrawing as ga, @routing as routing , @order as [order] , @reference as reference");
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Exemplo n.º 8
0
        public JsonResult Getledsearchdetail(int id)
        {
            var data       = Mainclass.Display("DECLARE @document NVARCHAR(max) DECLARE @certification NVARCHAR(max)  DECLARE @partwhere NVARCHAR(max)  DECLARE @productwhere NVARCHAR(max) exec sp_ledsearchdetail " + id + ", @document OUTPUT, @certification OUTPUT, @partwhere OUTPUT, @productwhere OUTPUT select  @document as document, @certification as certification, @partwhere as partwhere, @productwhere as productwhere");
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Exemplo n.º 9
0
        public ActionResult ChangePassword(string email, string password, string newpassword)
        {
            password = password != "undefined" ? password : "";
            byte[] array = Encoding.ASCII.GetBytes(password);
            var    data  = Mainclass.Display("exec sp_validateUser @Email = '" + email + "'");

            if ((data != null) && (data.Count > 0))
            {
                string username = data[0]["email"].ToString();
                string role     = data[0]["userRole"].ToString();
                Session["username"] = username;
                Session["role"]     = role;
                int status = Convert.ToInt32(data[0]["status"]);
                if (status != 1)
                {
                    return(Json(new { mode = 4, username }, JsonRequestBehavior.AllowGet));
                }
                byte[] pwd;

                if ((data[0]["password"] == DBNull.Value) && (password == ""))
                {
                    pwd = Encoding.ASCII.GetBytes(password);
                }
                else
                {
                    pwd = (byte[])data[0]["password"];
                }
                if (System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals(array, pwd))
                {
                    var data1 = Mainclass.Display("exec sp_changepwd @email = '" + email + "', @newpassword = '******'");
                    if ((data1 != null) && (data1.Count > 0))
                    {
                        string errorno = data1[0]["ErrorNumber"].ToString();
                        string errmsg  = data1[0]["ErrorMessage"].ToString();
                        if (errorno == "0")
                        {
                            return(Json(new { mode = 1 }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new { mode = 2, errormessage = errmsg }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json(new { mode = 6 }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { mode = 3 }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { mode = 5 }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 10
0
        public ActionResult Getpcndetail(int id)
        {
            var data = Mainclass.Display("DECLARE @problem NVARCHAR(max) DECLARE @solution NVARCHAR(max) DECLARE @impacted NVARCHAR(max)  exec[sp_pcndetail] " + id + ",@problem OUTPUT , @solution OUTPUT, @impacted OUTPUT  select  @problem as problem,@solution as solution,  @impacted as impacted");

            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Mainclass obj = new Mainclass();
     DataTable dtab = new DataTable();
     dtab = obj.check_route_id(DropDownList1.SelectedValue.ToString(), DropDownList2.SelectedValue.ToString(), Calendar1.SelectedDate.ToShortDateString());
     GridView1.DataSource = dtab;
     GridView1.DataBind();
     Button2.Visible = true;
     Button3.Visible = true;
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Mainclass obj  = new Mainclass();
        DataTable dtab = new DataTable();

        dtab = obj.check_route_id(DropDownList1.SelectedValue.ToString(), DropDownList2.SelectedValue.ToString(), Calendar1.SelectedDate.ToShortDateString());
        GridView1.DataSource = dtab;
        GridView1.DataBind();
        Button2.Visible = true;
        Button3.Visible = true;
    }
Exemplo n.º 13
0
        public ActionResult PcnSearch(string Pcnnumber, string PcnDescription, string problem, string solution, string impected)
        {
            //if (Convert.ToString(Session["username"]) != "")
            //{
            Pcnnumber      = Pcnnumber != "undefined" ? Pcnnumber : "";
            Pcnnumber      = Pcnnumber != "null" ? Pcnnumber.Replace("_", "[_]") : "";
            PcnDescription = PcnDescription != "undefined" ? PcnDescription.Replace("_", "[_]") : "";
            problem        = problem != "undefined" ? problem.Replace("_", "[_]") : "";
            impected       = impected != "undefined" ? impected.Replace("_", "[_]") : "";
            solution       = solution != "undefined" ? solution.Replace("_", "[_]") : "";

            //if (solution == "")
            //    dconum = null;
            //else
            //    dconum = Convert.ToInt32(solution);
            //int? parttyp = 0;
            //if (impected == "")
            //    parttyp = null;
            //else
            //    parttyp = Convert.ToInt32(impected);
            //int? vproblem = 0;
            //if (problem == "")
            //    vproblem = null;
            //else
            //    vproblem = Convert.ToInt32(problem);
            var data = Mainclass.DisplayDoc("exec sp_pcnsearch '" + Pcnnumber + "','" + PcnDescription + "','" + problem + "','" + solution + "','" + impected + "','" + count + "'");
            //for (int i = 0; i < data.Count; i++)
            //{
            //    var probem = Mainclass.Display("Select problemdata=(it.itemid+'/'+it.revision) from [dbo].[items] it  join pcnitem_report pcnreport on pcnreport.problemitem_iid=it.iid  join pcn_report pcn on pcn.pid='" + data[i]["pid"] + "'");
            //    var solutio = Mainclass.Display("Select problemdata=(it.itemid+'/'+it.revision) from [dbo].[items] it  join pcnitem_report pcnreport on pcnreport.problemitem_iid=it.iid  join pcn_report pcn on pcn.pid='" + data[i]["pid"] + "'");
            //    var impacted = Mainclass.Display("Select problemdata=(it.itemid+'/'+it.revision) from [dbo].[items] it  join pcnitem_report pcnreport on pcnreport.problemitem_iid=it.iid  join pcn_report pcn on pcn.pid='" + data[i]["pid"] + "'");


            //    data[i].Add("problem", probem);

            //    data[i].Add("solution", solutio);

            //    data[i].Add("impacted", impacted);
            //}
            //var data = model.sp_pcnsearch(Pcnnumber.ToString(), PcnDescription, vproblem, dconum, parttyp).ToList();
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);

            /*
             * }
             * else
             *  return Json("1", JsonRequestBehavior.AllowGet);*/
        }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Mainclass obj = new Mainclass();
        DataTable dtab = new DataTable();
        // dtab = obj.check_route_id(Session["source"].ToString(), Session["destination"].ToString(), Session["jdate"].ToString());

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if (((CheckBox)GridView1.Rows[i].FindControl("CheckBox1")).Checked)
            {
                string busno = GridView1.Rows[i].Cells[1].Text;
                Session["busno"] = busno;
                Response.Redirect("view_details.aspx");
            }
        }
    }
Exemplo n.º 15
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0)
     {
         Mainclass c = new Mainclass();
         c.message(TextBox1.Text, TextBox2.Text, TextBox3.Text);
         Label3.Visible = true;
         Label3.Text = "Message received Successfully ";
         TextBox1.Text = "";
         TextBox2.Text = "";
         TextBox3.Text = "";
     }
     else
         Label2.Visible = true;
         Label2.Text = "enter all the fields";
 }
Exemplo n.º 16
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            Mainclass obj = new Mainclass();
            int       i   = obj.username(TextBox3.Text.ToString());
            if (i == 1)
            {
                Label1.Visible = true;
                Label1.Text    = "Username already in use...Enter any other username";
            }
            else if (TextBox7.Text.Trim().Length != 10)
            {
                Label1.Visible = true;
                Label1.Text    = "Enter 10 digit contact number";
            }
            else if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0 && TextBox7.Text.Trim().Length > 0)
            {
                UserInfo nr = new UserInfo();

                nr.NewUserSignUp(TextBox1.Text.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox4.Text.ToString(), TextBox6.Text.ToString(), TextBox7.Text.ToString());
                Label1.Visible  = true;
                Label1.Text     = "Registration Sucessfully Done";
                TextBox1.Text   = "";
                TextBox2.Text   = "";
                TextBox3.Text   = "";
                TextBox4.Text   = "";
                TextBox5.Text   = "";
                TextBox6.Text   = "";
                TextBox7.Text   = "";
                Button2.Visible = true;
            }
            else
            {
                Label1.Visible = true;
            }
            Label1.Text = "Enter all the fields";
        }
        catch (Exception)
        {
            // Perform some action here, and then throw a new exception.
            Label1.Visible = true;
            Label1.Text    = ("Invalid input");
        }
    }
Exemplo n.º 17
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0)
     {
         Mainclass c = new Mainclass();
         c.message(TextBox1.Text, TextBox2.Text, TextBox3.Text);
         Label3.Visible = true;
         Label3.Text    = "Message received Successfully ";
         TextBox1.Text  = "";
         TextBox2.Text  = "";
         TextBox3.Text  = "";
     }
     else
     {
         Label2.Visible = true;
     }
     Label2.Text = "enter all the fields";
 }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Mainclass obj  = new Mainclass();
        DataTable dtab = new DataTable();

        // dtab = obj.check_route_id(Session["source"].ToString(), Session["destination"].ToString(), Session["jdate"].ToString());


        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if (((CheckBox)GridView1.Rows[i].FindControl("CheckBox1")).Checked)
            {
                string busno = GridView1.Rows[i].Cells[1].Text;
                Session["busno"] = busno;
                Response.Redirect("view_details.aspx");
            }
        }
    }
Exemplo n.º 19
0
        public int SendAMRMail(string email, string productid, string partNumber, string amrType, string file_path, string productName, string partDescription, string remarks)
        {
            string to     = email;
            string cc     = string.Empty;
            int    result = 1;

            if (productid != "" && productid != "0")
            {
                int product = Convert.ToInt32(productid);
                var dta     = model.products.Where(a => a.ProductID == product).FirstOrDefault();
                if (dta.ProductOwnerEmail != null && dta.ProductOwnerEmail != "")
                {
                    to = dta.ProductOwnerEmail;
                    cc = email;
                }
            }

            try
            {
                string mailBody    = ConfigurationManager.AppSettings["AMRMailBody"];
                string mailSubject = ConfigurationManager.AppSettings["AMRMailSubject"];
                if (amrType == "AMR Request")
                {
                    mailBody = string.Format(mailBody, amrType, email, partNumber, partDescription, "");
                }
                else if (amrType == "Data Issue")
                {
                    mailBody = string.Format(mailBody, amrType, email, partNumber, partDescription, "Product :- " + productName + "<BR>Remarks :-" + remarks.Replace("\\n", "<br>"));
                }
                else if (amrType == "Request For Basic Data")
                {
                    mailBody = string.Format(mailBody, "new request for Basic Data", email, partNumber, partDescription, "Product :- " + productName + "<BR>Remarks :-" + remarks.Replace("\\n", "<br>"));
                }
                //mailBody = string.Format(mailBody, "<b>" + email + "</b>", "<b>" + partNumber + "</b>", "<b>" + amrType + "</b>");
                mailSubject = string.Format(mailSubject, amrType, partNumber);
                Mainclass.BuildEmail(to, mailSubject, mailBody, cc, file_path);
                result = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Exemplo n.º 20
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            Mainclass obj = new Mainclass();
            int i = obj.username(TextBox3.Text.ToString());
            if (i == 1)
            {
                Label1.Visible = true;
                Label1.Text = "Username already in use...Enter any other username";
            }
            else if (TextBox7.Text.Trim().Length != 10)
            {
                Label1.Visible = true;
                Label1.Text = "Enter 10 digit contact number";
            }
            else if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0 && TextBox7.Text.Trim().Length > 0)
            {
                UserInfo nr = new UserInfo();

                nr.NewUserSignUp(TextBox1.Text.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox4.Text.ToString(), TextBox6.Text.ToString(), TextBox7.Text.ToString());
                Label1.Visible = true;
                Label1.Text = "Registration Sucessfully Done";
                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                TextBox4.Text = "";
                TextBox5.Text = "";
                TextBox6.Text = "";
                TextBox7.Text = "";
                Button2.Visible = true;

            }
            else
                Label1.Visible = true;
                Label1.Text = "Enter all the fields";
        }
        catch (Exception )
        {
            // Perform some action here, and then throw a new exception.
            Label1.Visible = true;
            Label1.Text=("Invalid input");
        }
    }
Exemplo n.º 21
0
        public ActionResult DatamartSearch(string searchString)
        {
            searchString = searchString.Trim();
            string whereClause = "1 = 1";

            searchString = searchString.Trim();
            //searchString = Regex.Replace(searchString, @"\s+", " ");
            string[] keywords = Regex.Split(searchString, @"\s+");
            foreach (string key in keywords)
            {
                whereClause = whereClause + " and itemdata like ''%" + key + "%''";
            }
            var data = Mainclass.DisplayDoc("exec sp_search_datamart @searchText ='" + whereClause.ToString() + "', @count = " + count);

            //var data = model.sp_docsearch(documentNumber.ToString(), documentDescription, legacyPartNumber, prtstatus, LegDocumentNumber, parttyp).ToList();
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Exemplo n.º 22
0
        public ActionResult UserSearch(string userID, string email, string userName, string userRole)
        {
            //if (Convert.ToString(Session["username"]) != "")
            //{
            userID   = userID != "undefined" ? userID : "";
            userID   = userID != "null" ? userID.Replace("_", "[_]") : "";
            email    = email != "undefined" ? email.Replace("_", "[_]") : "";
            userName = userName != "undefined" ? userName : "";
            userRole = userRole != "undefined" ? userRole.Replace("_", "[_]") : "";


            var data = Mainclass.Display("exec [sp_displayuser] '" + userID + "','" + email + "','" + userName + "','" + userRole + "'");
            /*model.sp_partsearch(Partnumber, LegPartNumer, prtstatus, dconum, LegDocNumber, parttyp).ToList();*/
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
            //}
            //else
            //    return Json("1", JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 23
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox5.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0 && TextBox7.Text.Trim().Length > 0 && TextBox8.Text.Trim().Length > 0 && TextBox9.Text.Trim().Length > 0)
         {
             Mainclass h = new Mainclass();
             h.hire(TextBox1.Text.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox4.Text.ToString(), DropDownList1.SelectedValue.ToString(), TextBox5.Text.ToString(), TextBox6.Text.ToString(), DropDownList2.SelectedValue.ToString(), TextBox7.Text.ToString(), TextBox8.Text.ToString(), TextBox9.Text.ToString());
             Label1.Visible = true;
             Label1.Text = "Message was sent successfully";
         }
         else
             Label2.Visible = true;
         Label2.Text = "Please fill in all the details";
     }
     catch (Exception)
     {
         Label2.Visible = true;
         Label2.Text = "Invalid input";
     }
 }
Exemplo n.º 24
0
        public ActionResult AMRSearch(string amrType, string amrEmail, string amrStatus, string amrItemNo, string amrRequestNo, string amrNewMaterialCode, string amrPartDescription)
        {
            //if (Convert.ToString(Session["username"]) != "")
            //{
            amrEmail           = amrEmail != "undefined" ? amrEmail : "";
            amrItemNo          = amrItemNo != "undefined" ? amrItemNo.Replace("_", "[_]") : "";
            amrRequestNo       = amrRequestNo != "undefined" ? amrRequestNo.Replace("_", "[_]") : "";
            amrNewMaterialCode = amrNewMaterialCode != "undefined" ? amrNewMaterialCode : "";
            amrPartDescription = amrPartDescription != "undefined" ? amrPartDescription.Replace("_", "[_]") : "";

            string query = "exec [sp_displayamrrequest] '" + amrType + "','" + amrEmail + "','" + amrStatus + "','" + amrItemNo + "','" + amrRequestNo + "','" + amrNewMaterialCode + "','" + amrPartDescription + "'";
            var    data  = Mainclass.Display("exec [sp_displayamrrequest] '" + amrType + "','" + amrEmail + "','" + amrStatus + "','" + amrItemNo + "','" + amrRequestNo + "','" + amrNewMaterialCode + "','" + amrPartDescription + "'");
            /*model.sp_partsearch(Partnumber, LegPartNumer, prtstatus, dconum, LegDocNumber, parttyp).ToList();*/
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
            //}
            //else
            //    return Json("1", JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 25
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (TextBox1.Text.Trim().Length > 0 && TextBox2.Text.Trim().Length > 0 && TextBox3.Text.Trim().Length > 0 && TextBox4.Text.Trim().Length > 0 && TextBox5.Text.Trim().Length > 0 && TextBox6.Text.Trim().Length > 0 && TextBox7.Text.Trim().Length > 0 && TextBox8.Text.Trim().Length > 0 && TextBox9.Text.Trim().Length > 0)
         {
             Mainclass h = new Mainclass();
             h.hire(TextBox1.Text.ToString(), TextBox2.Text.ToString(), TextBox3.Text.ToString(), TextBox4.Text.ToString(), DropDownList1.SelectedValue.ToString(), TextBox5.Text.ToString(), TextBox6.Text.ToString(), DropDownList2.SelectedValue.ToString(), TextBox7.Text.ToString(), TextBox8.Text.ToString(), TextBox9.Text.ToString());
             Label1.Visible = true;
             Label1.Text    = "Message was sent successfully";
         }
         else
         {
             Label2.Visible = true;
         }
         Label2.Text = "Please fill in all the details";
     }
     catch (Exception)
     {
         Label2.Visible = true;
         Label2.Text    = "Invalid input";
     }
 }
Exemplo n.º 26
0
        public ActionResult PartSearch(string Partnumber, string LegPartNumer, string partStatus, string DocNumber, string LegDocNumber, string PartType, string PartDescription)
        {
            //if (Convert.ToString(Session["username"]) != "")
            //{
            Partnumber      = Partnumber != "undefined" ? Partnumber : "";
            Partnumber      = Partnumber != "null" ? Partnumber.Replace("_", "[_]") : "";
            LegPartNumer    = LegPartNumer != "undefined" ? LegPartNumer.Replace("_", "[_]") : "";
            partStatus      = partStatus != "undefined" ? partStatus : "";
            DocNumber       = DocNumber != "undefined" ? DocNumber.Replace("_", "[_]") : "";
            LegDocNumber    = LegDocNumber != "undefined" ? LegDocNumber.Replace("_", "[_]") : "";
            PartType        = PartType != "undefined" ? PartType : "";
            PartDescription = PartDescription != "undefined" ? PartDescription.Replace("_", "[_]") : "";


            var data = Mainclass.Display("exec sp_partsearch '" + Partnumber + "','" + LegPartNumer + "','" + partStatus + "','" + DocNumber + "','" + LegDocNumber + "','" + PartType + "','" + PartDescription + "','" + count + "'");
            /*model.sp_partsearch(Partnumber, LegPartNumer, prtstatus, dconum, LegDocNumber, parttyp).ToList();*/
            var jsonResult = Json(data, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
            //}
            //else
            //    return Json("1", JsonRequestBehavior.AllowGet);
        }
        public Mainclass GetPerformancReport(string batch, long type)
        {
            DataTable dt = new DataTable();

            dt = ToDataTable(_context.Sp_GetPerformancePWithParamRepots(batch, type).ToList());
            List <BarGraph> ss = new List <BarGraph>();
            Mainclass       mn = new Mainclass();

            if (dt.Rows.Count != 0)
            {
                DataView  view = new DataView(dt);
                string[]  sss;
                DataTable distinctValues = view.ToTable(true, "ParameterName");
                sss = new string[distinctValues.Rows.Count];
                for (int q = 0; q < distinctValues.Rows.Count; q++)
                {
                    sss[q]    = (distinctValues.Rows[q]["ParameterName"]).ToString();
                    mn.labels = sss;
                }
                Array.Sort(mn.labels, StringComparer.InvariantCulture);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BarGraph bar = new BarGraph();
                if (mn.datasets == null)
                {
                    bar.label           = (dt.Rows[i]["BatchName"]).ToString();
                    bar.backgroundColor = "#FF6000";
                    var strExpr = "Id =" + Convert.ToInt32(dt.Rows[i]["Id"]);
                    dt.DefaultView.RowFilter = strExpr;
                    decimal[] sss;
                    DataTable dts = (dt.DefaultView).ToTable();
                    sss = new decimal[dts.Rows.Count];
                    foreach (var p in mn.labels)
                    {
                        for (int q = 0; q < dts.Rows.Count; q++)
                        {
                            if (Convert.ToString(dts.Rows[q]["ParameterName"]) == p)
                            {
                                sss[q]   = Convert.ToDecimal(dts.Rows[q]["Result"]);
                                bar.data = sss;
                            }
                        }
                    }
                    ss.Add(bar);
                    mn.datasets = ss;
                }
                else
                {
                    string          djfkjd = (dt.Rows[i]["BatchName"]).ToString();
                    List <BarGraph> ssss   = (from s in mn.datasets where s.label == (dt.Rows[i]["BatchName"]).ToString() select s).ToList();
                    if (ssss.Count == 0)
                    {
                        bar.label = (dt.Rows[i]["BatchName"]).ToString();
                        if (ssss.Count == 2)
                        {
                            bar.backgroundColor = "#00ffad";
                        }
                        else if (ssss.Count == 3)
                        {
                            bar.backgroundColor = "#00BDC9";
                        }
                        var strExpr = "Id =" + Convert.ToInt32(dt.Rows[i]["Id"]);
                        dt.DefaultView.RowFilter = strExpr;
                        decimal[] sss;
                        DataTable dts = (dt.DefaultView).ToTable();
                        sss = new decimal[dts.Rows.Count];
                        foreach (var p in mn.labels)
                        {
                            for (int q = 0; q < dts.Rows.Count; q++)
                            {
                                if (Convert.ToString(dts.Rows[q]["ParameterName"]) == p)
                                {
                                    sss[q]   = Convert.ToDecimal(dts.Rows[q]["Result"]);
                                    bar.data = sss;
                                }
                            }
                        }
                        ss.Add(bar);
                        mn.datasets = ss;
                    }
                }
            }
            if (mn.datasets != null)
            {
                if (mn.datasets.Count == 3)
                {
                    mn.datasets[2].backgroundColor = "#a1db32";
                }
            }
            return(mn);
        }
Exemplo n.º 28
0
        public ActionResult CreateAMRRequest(string amrType, string amrTypeName, string userEmail, string amrPartStatus, string amrPartNo, string amrPartDescription, string amrNewMaterialCode, string amrExistingMaterial, string amrRequestNumber, string amrDrawingNumber, string amrDrawingRevNo, string amrSite, string amrPriority, string amrDCO, string amrDueDate, string amrCastingRequest, string productId, string remarks, string productName, string file_data)
        {
            try
            {
                if (Request.Files.Count > 0)
                {
                    file_data = UploadFile();
                }
                else
                {
                    file_data = "";
                }
                amrType             = amrType != "undefined" ? amrType : "0";
                userEmail           = userEmail != "undefined" ? userEmail : "";
                amrPartStatus       = amrPartStatus != "undefined" ? amrPartStatus : "0";
                amrPartNo           = amrPartNo != "undefined" ? amrPartNo : "";
                amrPartDescription  = amrPartDescription != "undefined" ? amrPartDescription : "";
                amrNewMaterialCode  = amrNewMaterialCode != "undefined" ? amrNewMaterialCode : "";
                amrExistingMaterial = amrExistingMaterial != "undefined" ? amrExistingMaterial : "";
                amrRequestNumber    = amrRequestNumber != "undefined" ? amrRequestNumber : "";
                amrDrawingNumber    = amrDrawingNumber != "undefined" ? amrDrawingNumber : "";
                amrDrawingRevNo     = amrDrawingRevNo != "undefined" ? amrDrawingRevNo : "";
                amrSite             = amrSite != "undefined" ? amrSite : "";
                amrPriority         = amrPriority != "undefined" ? amrPriority : "";
                amrDCO            = amrDCO != "undefined" ? amrDCO : "";
                amrDueDate        = amrDueDate != "undefined" ? amrDueDate : "";
                amrCastingRequest = amrCastingRequest != "undefined" ? amrCastingRequest : "";
                productId         = productId != "undefined" ? productId : "";
                productName       = productName != "undefined" ? productName : "";
                file_data         = file_data != "undefined" ? file_data : "";
                remarks           = remarks != "undefined" ? remarks : "";
                remarks           = remarks.Replace("\n", "\\n");
                //var data = Mainclass.Display(@"exec [sp_createamrrequest] '" + amrType + "','" + userEmail + "','" + amrPartStatus + "','" + amrPartNo + "','" + amrPartDescription + "','" + amrNewMaterialCode + "','" + amrExistingMaterial + "','" + amrRequestNumber + "','" + amrDrawingNumber + "','" + amrDrawingRevNo + "','" + amrSite + "','" + amrPriority + "','" + amrDCO + "','" + amrDueDate + "','" + amrCastingRequest + "','" + productId + "','" + file_data + "','" + remarks + "'");

                var data = Mainclass.Display("exec [sp_createamrrequest] @amr_type_id = '" + amrType + "', @requested_by = '" + userEmail + "', @status = '" + amrPartStatus + "', @item_no = '" + amrPartNo + "', @part_description = '" + amrPartDescription + "', @new_material_code = '" + amrNewMaterialCode + "', @existing_material_code = '" + amrExistingMaterial + "', @request_no = '" + amrRequestNumber + "', @drawing_no = '" + amrDrawingNumber + "', @drawing_rev_no = '" + amrDrawingRevNo + "', @site = '" + amrSite + "', @priority = '" + amrPriority + "', @dco = '" + amrDCO + "', @due_date = '" + amrDueDate + "', @casting_requested = '" + amrCastingRequest + "', @productid = '" + productId + "', @file_path = '" + file_data + "', @remarks = '" + remarks + "'");


                if (data != null && data.Count > 0)
                {
                    if (data[0]["ErrorNumber"].ToString() == "0")
                    {
                        try
                        {
                            SendAMRMail(userEmail, productId, amrPartNo, amrTypeName, file_data, productName, amrPartDescription, remarks);
                        }
                        catch (Exception ex)
                        {
                            return(Json(new { ErrorNumber = 2, ErrorMessage = "AMR Record saved. Email failed  :" + ex.Message }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    var    jsonResult = Json(data, JsonRequestBehavior.AllowGet);
                    string errorno    = data[0]["ErrorNumber"].ToString();
                    string errmsg     = data[0]["ErrorMessage"].ToString();
                    return(Json(new { ErrorNumber = errorno, ErrorMessage = errmsg }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { ErrorNumber = 1, ErrorMessage = "Unexpected Error in Database Procedure" }, JsonRequestBehavior.AllowGet));
                }
                /*model.sp_partsearch(Partnumber, LegPartNumer, prtstatus, dconum, LegDocNumber, parttyp).ToList();*/
            }
            catch (Exception ex)
            {
                return(Json(new { ErrorNumber = 1, ErrorMessage = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 29
0
        private void button3_Click(object sender, EventArgs e)
        {
            registaretionFormControl x = new registaretionFormControl;

            Mainclass.showcontrol(x, Content);
        }
Exemplo n.º 30
0
        public ActionResult Login1(string email, string password, string context = "") //KAMLESH-ROLE
        {
            //    var remember = fc["rememberme"] != null ? true : false;
            //    string email = Convert.ToString(fc["Email"]);
            //    string pass = Convert.ToString(fc["Password"]);
            //    HttpCookie emailCookie = new HttpCookie("Email");
            //    HttpCookie passCookie = new HttpCookie("Password");
            //    if (remember == true)
            //    {

            //        //Set the Cookie value.
            //        emailCookie.Values["Name"] = email;
            //        passCookie.Values["Password"] = pass;
            //        //Set the Expiry date.

            //    }
            //    else
            //    {
            //        emailCookie.Values["Name"] = null;
            //        passCookie.Values["Password"] = null;
            //    }
            //    emailCookie.Expires = DateTime.Now.AddDays(15);
            //    passCookie.Expires = DateTime.Now.AddDays(15);
            //    Response.Cookies.Add(emailCookie);
            //    Response.Cookies.Add(passCookie);
            byte[] array = Encoding.ASCII.GetBytes(password);

            var data = Mainclass.Display("exec sp_validateUser @Email = '" + email + "'");

            //var jsonResult = Json(data, JsonRequestBehavior.AllowGet);
            //jsonResult.MaxJsonLength = int.MaxValue;


            //var dta = model.users.Where(a => a.email == email && a.password == array).FirstOrDefault();
            if ((data != null) && (data.Count > 0))
            {
                string username = data[0]["email"].ToString();
                string role     = data[0]["userRole"].ToString();
                Session["username"] = username;
                Session["role"]     = role;
                int status = Convert.ToInt32(data[0]["status"]);
                if (data[0]["password"] == DBNull.Value)
                {
                    return(Json(new { mode = 5, username }, JsonRequestBehavior.AllowGet));
                }

                byte[] pwd = (byte[])data[0]["password"];
                if (status != 1)
                {
                    return(Json(new { mode = 4, username }, JsonRequestBehavior.AllowGet));
                }
                if ((role == "Admin") && (context != "ADM"))
                {
                    return(Json(new { mode = 2 }, JsonRequestBehavior.AllowGet));
                }
                if ((role == "RegularUser") && (context != "APP"))
                {
                    return(Json(new { mode = 2 }, JsonRequestBehavior.AllowGet));
                }
                if (System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals(array, pwd))
                {
                    return(Json(new { mode = 1, username, role }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { mode = 3 }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { mode = 2 }, JsonRequestBehavior.AllowGet));
            }
        }