Exemple #1
0
        public static string GetProductStatus(string input)
        {
            string[]   dlim = { AAAK.DELIM };
            string[]   arr  = input.Split(dlim, StringSplitOptions.None);
            CustomCode x    = new CustomCode();

            return(x.GetProductStatus(arr[0], arr[1], arr[2]));
        }
 public static string registerLocation(string input)
 {
     try
     {
         CustomCode x = new CustomCode();
         return(x.registerLocation(input));
     }
     catch (Exception ex)
     {
         return(ex.Message + ex.StackTrace);
     }
 }
 public static string autoCompleteAddress(string input)
 {
     try
     {
         CustomCode x = new CustomCode();
         return(x.autoCompleteAddress(input));
     }
     catch (Exception ex)
     {
         string strErr = ex.Message + ex.StackTrace;
         return("");
     }
 }
Exemple #4
0
 public static string deleteBOM(string input)
 {
     try
     {
         CustomCode x = new CustomCode();
         return(x.deleteBOM(input));
     }
     catch (Exception ex)
     {
         string strErr = ex.Message + ex.StackTrace;
         return("[]");
     }
 }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string html = "";

            try
            {
                //Check for URL Parameters-- that determines if this page is being called to view an existing bom
                string p     = Request.QueryString["p"];
                string pR    = Request.QueryString["pR"];
                string bR    = Request.QueryString["bR"];
                string desNm = Request.QueryString["h"];
                if (p != null && pR != null && bR != null)
                {
                    CustomCode x = new CustomCode();
                    html = x.DownloadHTMLforBOM(p, pR, bR);
                    divResult.Controls.Add(new LiteralControl(html));
                    txtProduct.Text       = p.ToUpper();
                    txtProductRev.Text    = pR.ToUpper();
                    txtBOMRev.Text        = bR.ToUpper();
                    txtProductStatus.Text = x.GetProductStatus(p, pR, bR).ToUpper();
                    if (txtProductStatus.Text.ToUpper() == RELEASEKEY.ToUpper())
                    {
                        btnUpload.Enabled = false;
                        btnUpload.Style.Add("display", "none");
                        divBrowse.Style.Add("display", "none");
                    }

                    this.Title = txtProduct.Text + " Rev " + txtProductRev.Text + " (BOM Rev " + txtBOMRev.Text.PadLeft(2, '0') + ")";
                }
                else if (desNm != null)
                {
                    CustomCode x = new CustomCode();
                    html = x.DownloadHTMLforBOMHistory(desNm);
                    divResult.Controls.Add(new LiteralControl(html));
                    txtProduct.Text       = desNm.ToUpper();
                    txtProductRev.Text    = "";
                    txtBOMRev.Text        = "";
                    txtProductStatus.Text = "";
                    this.Title            = desNm + " History";
                }
                else
                {
                    this.Title = "BOM View and Upload";
                }
            } catch (Exception ex) {
                divResult.Controls.Add(new LiteralControl(DynControls.renderLiteralControlErrorString(ex, html)));
            }
        }
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            if (activity.Type == ActivityTypes.Message)
            {
                if (activity.ChannelId == ChannelIds.Msteams && activity.Text.StartsWith("\r\n"))
                {
                    activity.Text = CustomCode.SanatizeMagicCodeForTeams(activity.Text);
                }
                if (activity.ChannelId == ChannelIds.Sms && activity.From.Id.Contains("+"))
                {
                    activity.From.Id = activity.From.Id.Substring(1, activity.From.Id.Length - 1);
                }
                await Conversation.SendAsync(activity, () => new RootDialog());
            }
            else
            {
                await HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
Exemple #7
0
 /// <summary>
 /// Creates elements based on the fields in a database.
 /// Optionally, the elements are enclosed in a from with ID 'form_[formID]'.
 /// </summary>
 /// <param name="appID">The appID on which these controls are based.</param>
 /// <param name="cntlContainer">The container that contains these controls</param>
 /// <param name="dctDefaultOverride">A dictionary that maps the default value given in the database
 /// with the value to use as an override</param>
 /// <param name="uid">A unique identified to append to the control IDs of the generated controls.
 /// You will need this if you are calling this method several times to generate similar output one page.
 /// (One recommended value for thie Unique ID is the Database ID).</param>
 /// <param name="cntlDisplayStyle"></param>
 /// <param name="blElementsInLine">Set false to allow displaying all elements in line (no line breaks)</param>
 /// <param name="blRunAtServer">When TRUE, includes runat=server as a property of all controls</param>
 public static void GenerateControlsFromDatabase(int appID, System.Web.UI.Control cntlContainer,
                                                 Dictionary <string, string> dctDefaultOverride = null, string uid = "", int cntlDisplayStyle = -1,
                                                 Boolean blElementsInLine = false, Boolean blRunAtServer           = false)
 {
     try
     {
         if (dctDefaultOverride == null)
         {
             dctDefaultOverride = new Dictionary <string, string>();
         }
         SqlCommand          cmd   = new SqlCommand();
         clsDB               myDB  = new clsDB();
         ControlCollection   cntls = new ControlCollection(cntlContainer);
         List <SqlParameter> ps    = new List <SqlParameter>();
         ps.Add(new SqlParameter("@" + DBK.fkAPPID, appID));
         using (myDB.OpenConnection())
         {
             using (SqlDataReader dR = (SqlDataReader)myDB.ExecuteSP(DBK.SP.spGETWEBDISPLAYFIELDINFO,
                                                                     ps,
                                                                     clsDB.SPExMode.READER,
                                                                     ref cmd)
                    )
             {
                 if ((dR != null) && (dR.HasRows))
                 {
                     CustomCode x = new CustomCode();
                     x.ConstructInputControls(dR, cntlContainer, dctDefaultOverride, uid, cntlDisplayStyle,
                                              blElementsInLine, blRunAtServer);
                 }
             }
         }
     } catch (Exception ex)
     {
         cntlContainer.Controls.Add(renderLiteralControlError(ex, ""));
     }
 }
 public PasswordsDoesntMatchBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 400003;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
        public static string getHTMLForPartNumberID(string input)
        {
            CustomCode x = new CustomCode();

            return(x.getHTMLForPartNumberID(input));
        }
        public Boolean UploadToDB()
        {
            try
            {
                CustomCode u      = new CustomCode();
                Int64      assyID = -1;
                if (m_lstObsoleteParts.Count > 0 || m_lstUndefinedPNs.Count > 0)
                {
                    return(false);
                }
                m_errMsg.Clear();
                //First, we need to make an entry in table asyBOM so we can get the DB ID of the Assy
                xDB = new clsDB();
                cmd = new SqlCommand();
                List <SqlParameter> ps = new List <SqlParameter>();
                string assyDesc        = "ASSY," + m_topLevelName;
                ps.Add(new SqlParameter("@" + DBK.strNAME, m_topLevelName));
                ps.Add(new SqlParameter("@" + DBK.strASSYPARTNUMBER, m_assyPN));
                ps.Add(new SqlParameter("@" + DBK.strREVISION, m_assyRev));
                ps.Add(new SqlParameter("@" + DBK.intBOMREV, m_bomRev));
                ps.Add(new SqlParameter("@" + DBK.strDESCRIPTION, assyDesc));
                ps.Add(new SqlParameter("@intMajor", u.getMajorRev(m_assyRev)));
                ps.Add(new SqlParameter("@intMinor", u.getMinorRev(m_assyRev)));
                ps.Add(new SqlParameter("@" + DBK.keyUPLOADEDBY, u.getUserDBID()));
                ps.Add(new SqlParameter("@" + DBK.keyASSYBU, u.getUserdBUID()));
                ps.Add(new SqlParameter("@" + DBK.keyREASONFORREV, 1));
                ps.Add(new SqlParameter("@" + DBK.keyASSYSTATUS, 1));
                ps[ps.Count - 1].Direction = System.Data.ParameterDirection.InputOutput;
                ps.Add(new SqlParameter("@" + DBK.ID, -1));
                ps[ps.Count - 1].Direction = System.Data.ParameterDirection.Output;
                using (xDB.OpenConnection())
                {
                    xDB.ExecuteSP(DBK.SP.spUPSERTASSYBOMENTRY, ps, clsDB.SPExMode.NONQUERY, ref cmd);
                    if (int.Parse(cmd.Parameters["@" + DBK.keyASSYSTATUS].Value.ToString()) == 1)
                    {
                        assyID = Int64.Parse(cmd.Parameters["@" + DBK.ID].Value.ToString());
                        //Delete this ASSY ID From the database
                        List <SqlParameter> tmpLstP = new List <SqlParameter>();
                        tmpLstP.Add(new SqlParameter("@" + DBK.keyASSY, assyID));
                        SqlCommand tmpCmd = new SqlCommand();
                        using (xDB.OpenConnection())
                        {
                            xDB.ExecuteSP(DBK.SP.spDELETEASSYBOMPARTS, tmpLstP, clsDB.SPExMode.NONQUERY, ref tmpCmd);
                        }
                        StringBuilder sqlStr = new StringBuilder();
                        sqlStr.Append("INSERT INTO " + DBK.asyBOMPARTS + " (" + DBK.keyASSY + ", " + DBK.keyPN + ", " +
                                      DBK.strREFDES + ", " + DBK.strBOMNOTES + ", " + DBK.intQTY + ") VALUES ");
                        //The values we will insert are in m_BOM
                        foreach (string assyPNKy in m_BOM.Keys)
                        {
                            string abk = assyPNKy;
                            foreach (string PNKy in m_BOM[assyPNKy].Keys)
                            {
                                AssyBomLineItem x        = m_BOM[assyPNKy][PNKy];
                                string          bomNotes = x.BOMNotes;
                                if (bomNotes == "" || bomNotes == "-")
                                {
                                    bomNotes = "''";
                                }
                                sqlStr.Append("(" +
                                              assyID + ", " +
                                              x.PNID.ToString() + ", " +
                                              "'" + x.RefDes + "', " +
                                              bomNotes + ", " +
                                              x.Qty.ToString() + "),");
                            }
                        }

                        //Remove the last comma
                        sqlStr.Remove(sqlStr.Length - 1, 1);
                        cmd.Parameters.Clear();
                        using (xDB.OpenConnection())
                        {
                            if (xDB.ExecuteNonQuery(sqlStr.ToString()))
                            {
                                if (xDB.NAffectedRows > 0)
                                {
                                    return(true);
                                }
                                else
                                {
                                    m_errMsg.Append("Executed following query without errors:" +
                                                    sqlStr + AAAK.vbCRLF + "...but no rows were affected by the Statement.  Please report this bug.");
                                    return(false);
                                }
                            }
                            else
                            {
                                m_errMsg.Append("Method UploadToDB: Unable to execute Nonquery: " +
                                                sqlStr + AAAK.vbCRLF + xDB.ErrMsg);
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        m_errMsg.Append(m_topLevelName + " Revision " + m_assyRev + " BOM Revision " + m_bomRev +
                                        "is RELEASED.  You cannot upload a new BOM if it's status is RELEASED." + AAAK.vbCRLF +
                                        "If you want to upload a new BOM, you must change the Assembly and/or BOM revision.");
                        return(false);
                    }
                }
            } catch (Exception ex)
            {
                m_errMsg.Append(ex.Message + AAAK.vbCRLF + ex.StackTrace);
                return(false);
            }
        }
 public InvalidRefreshTokenBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 4000010;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
        public static string updatePartInventory(string input)
        {
            CustomCode x = new CustomCode();

            return(x.UpdatePartInventory(input));
        }
        public static string MakePartNumberInventoryHistoryTable(string input)
        {
            CustomCode x = new CustomCode();

            return(x.MakePartNumberInventoryHistoryTable(Int64.Parse(input)));
        }
Exemple #14
0
 public SendEmailBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 400008;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
 public SettingNotFoundException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 404002;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
 public RefreshTokenNotFoundException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 404003;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
 public FileInvalidTypeBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 400007;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
Exemple #18
0
        public static string EditReleaseNote(string input)
        {
            CustomCode x = new CustomCode();

            return(x.EditReleaseNote(input, false));
        }
        public static string findMatchingPN(string input)
        {
            CustomCode x = new CustomCode();

            return(x.findMatchingPN(input));
        }
        public static string getNewOTSPN(string input)
        {
            CustomCode x = new CustomCode();

            return(x.getNewOTSPN(input));
        }
 public AccountInactiveForbiddenException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 403001;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
Exemple #22
0
        public static string EditReleaseNote_Reset(string input)
        {
            CustomCode x = new CustomCode();

            return(x.EditReleaseNote(input, true));
        }
Exemple #23
0
 public OldPasswordIncorrectBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 400004;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
        public static string getHTMLForPartNumberIDInventory(string input)
        {
            CustomCode x = new CustomCode();

            return(x.InvForPN(input));
        }
        public static string UpdateVPNData(string input)
        {
            CustomCode x = new CustomCode();

            return(x.UpdateVPNData(input));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //check for any url encoded parameters
            string foundIDData = "";

            if (Request.QueryString.HasKeys())
            {
                try
                {
                    CustomCode x        = new CustomCode();
                    string     targetID = Request.QueryString["ID"];
                    //The following is a bogus division that will go at the end of the displayed page so that the client can't obtain the ID
                    string htmlForID = "<div " +
                                       DynControls.encodeProperty("id", "x_" + targetID) +
                                       DynControls.encodeProperty("class", "getID") + " ></div>";
                    //Get the PN associated with the targetID
                    clsDB               myDB = new clsDB();
                    SqlCommand          cmd  = new SqlCommand();
                    List <SqlParameter> ps   = new List <SqlParameter>();
                    ps.Add(new SqlParameter("@pnID", Int64.Parse(targetID)));
                    string pageHeader = "";
                    using (myDB.OpenConnection())
                    {
                        using (SqlDataReader dR = (SqlDataReader)myDB.ExecuteSP(DBK.SP.spOTSGETPNINFO, ps, clsDB.SPExMode.READER, ref cmd))
                        {
                            if (dR != null && dR.HasRows)
                            {
                                dR.Read();
                                pageHeader = myDB.Fld2Str(dR[DBK.strPARTNUMBER]);
                            }
                        }
                    }

                    if (Request.QueryString["INV"] != null)
                    {
                        pageHeader  = DynControls.html_header_string(pageHeader + " Inventory", 1);
                        foundIDData = pageHeader + x.InvForPN(targetID) + htmlForID;
                    }
                    else if (Request.QueryString["INVH"] != null)
                    {
                        pageHeader  = DynControls.html_header_string(pageHeader + " Inventory History", 1);
                        foundIDData = pageHeader + x.MakePartNumberInventoryHistoryTable(Int64.Parse(targetID)) + htmlForID;
                    }
                    else
                    {
                        foundIDData = x.getHTMLForPartNumberID(targetID);
                    }
                    otsdivs.Controls.Add(new LiteralControl(foundIDData));
                    foreach (Control c in divMenuButtons.Controls)
                    {
                        divMenuButtons.Controls.Remove(c);
                    }
                    return;
                } catch (Exception ex)
                {
                    string x = ex.Message + ex.StackTrace;
                }
            }
            //Create three panels and add them to the existing div
            Panel divOTSNew = new Panel();

            divOTSNew.ID = "divOTSNew";
            divOTSNew.Style.Add(HtmlTextWriterStyle.Display, "none");
            otsdivs.Controls.Add(divOTSNew);

            //There are two panels in divOTSNew: divOTSNewIn and divOTSNewOut

            Panel divOTSNewIn = new Panel();

            divOTSNewIn.ID = "divOTSNewIn";
            //Get the input controls from the database for divOTSNewIn...
            DynControls.GenerateControlsFromDatabase(DBK.AppKeys.GET_NEWOTSPN, divOTSNewIn);
            //Add a Submit button
            divOTSNewIn.Controls.Add(DynControls.html_button("btnOTSNewIn", "SUBMIT", "inputButton",
                                                             true, AAAK.DISPLAYTYPES.BLOCK, "Create an OTS Part Number", "frmNewOTS"));
            //...and add a div for the ajax output
            Panel divOTSNewOut = new Panel();

            divOTSNewOut.ID = "divOTSNewOut";
            divOTSNewOut.Controls.Add(new LiteralControl("<p>Enter the information on the left, then press Submit to get your new OTS Part Number.</p>"));
            //Add these two sub panels
            divOTSNew.Controls.Add(divOTSNewIn);
            divOTSNew.Controls.Add(divOTSNewOut);
            //***** End divOTSNew

            //***** Start divOTSFind
            Panel divOTSFind = new Panel();

            divOTSFind.ID = "divOTSFind";
            divOTSFind.Style.Add(HtmlTextWriterStyle.Display, "none");
            //divOTSFind.Style.Add(HtmlTextWriterStyle.OverflowX, "auto");
            otsdivs.Controls.Add(divOTSFind);
            //Now: The html in this div is simple, but as the user make selections, the AJAX calls increase the
            //complexity of the children's html.
            //This div has 3 divs.
            ///divOTSFind Child Div 1:
            Panel divSearch = new Panel();

            divSearch.ID = "divSearch";

            DynControls.GenerateControlsFromDatabase(DBK.AppKeys.SEARCH_OTS, divSearch, null, "", -1, true);
            //Create the search button
            string btnSearchHtmlString = DynControls.html_button_string("btnLook", "SEARCH", "searchButton",
                                                                        true, AAAK.DISPLAYTYPES.BLOCK, form: "frmSearchOTS");

            divSearch.Controls.Add(new LiteralControl(btnSearchHtmlString));

            ///divOTSFind Child Div 2:
            ///The message div
            Panel divSearchMsg = new Panel();

            divSearchMsg.Style.Add(HtmlTextWriterStyle.Display, "block");
            divSearchMsg.ID = "divMessage";
            divSearchMsg.Controls.Add(new LiteralControl("<p " + DynControls.encodeProperty("id", "searchmsg") + ">" +
                                                         "Enter search criteria above to find Part Number Information.</p>"));
            ///divOTSFind Child Div 3:
            ///
            Panel divLook = new Panel();

            divLook.Style.Add(HtmlTextWriterStyle.Display, "block");
            divLook.Style.Add(HtmlTextWriterStyle.OverflowX, "auto");
            divLook.ID = "divLook";
            /// divLook's html will be determine when user presses SEARCH

            ///Add the three divs to divOTSFind
            divOTSFind.Controls.Add(divSearch);
            divOTSFind.Controls.Add(new LiteralControl("<div></div>"));
            divOTSFind.Controls.Add(divSearchMsg);
            divOTSFind.Controls.Add(divLook);

            Panel divOTSAdmin = new Panel();

            divOTSAdmin.ID = "divOTSAdmin";
            divOTSAdmin.Controls.Add(new LiteralControl("<p>Admin</p>"));
            divOTSAdmin.Style.Add(HtmlTextWriterStyle.Display, "none");
            otsdivs.Controls.Add(divOTSAdmin);
        }
Exemple #27
0
 public UnauthorizedException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 401001;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }
        public static string WhereUsedForPN(string input)
        {
            CustomCode x = new CustomCode();

            return(x.WhereUsedForPN(input));
        }
Exemple #29
0
        public static string respond(string input)
        {
            CustomCode x = new CustomCode();

            return(x.respondToSubmitButton(input));
        }
 public PasswordRequirementsBadRequestException(IStringLocalizer <object> localizer) : base()
 {
     CustomCode    = 400002;
     CustomMessage = localizer.GetString(CustomCode.ToString());
 }