//[AuthorizeAdmin(Permissions = new Permission[] { Permission.Floor_Create, Permission.Floor_Edit })]
        public ActionResult Create(NOTIFY model)
        {
            var result = NotifyService.Create(model);

            return
                (Json(
                     new RedirectCommand()
            {
                Code = result.Code, Message = result.Message, Url = Url.Action("IndexUser", new { id = model.ID })
            },
                     JsonRequestBehavior.AllowGet));
        }
 /// <summary>Adds a standard notification to your screen.</summary>
 /// <param name="luaState">Pointer to lua_State struct.</param>
 /// <param name="text">The string to display.</param>
 /// <param name="notifyType">Determines the method for displaying the notification.</param>
 /// <param name="length">The number of seconds to display the notification for.</param>
 public static void AddLegacy(LuaState luaState, string text, NOTIFY notifyType, double length)
 {
     lock (SyncRoot)
     {
         lua_getglobal(luaState, nameof(notification));
         lua_getfield(luaState, -1, nameof(AddLegacy));
         lua_pushstring(luaState, text);
         lua_pushnumber(luaState, (int)notifyType);
         lua_pushnumber(luaState, length);
         lua_pcall(luaState, 3);
     }
 }
Exemple #3
0
 public static CommandResult Create(NOTIFY c)
 {
     using (var context = new GST_MockProjectEntities())
     {
         c.UserCreate = UserService.GetUserInfo().ID;
         c.TimeCreate = DateTime.Now;
         c.Status     = Notifi_Status.ChuaXem;
         context.NOTIFies.Add(c);
         context.SaveChanges();
         //TODO
         //context.Log(c, LogType.BankBranch_Create, userId, "", HttpContext.Current.Request.Form);
         return(new CommandResult());
     }
 }
        protected void lnkSaveSupp(object sender, EventArgs e)
        {
            PLANT         plant  = (PLANT)SessionManager.EffLocation.Plant;
            LinkButton    lnk    = (LinkButton)sender;
            string        cmdID  = lnk.CommandArgument;
            PSsqmEntities ctx    = new PSsqmEntities();
            NOTIFY        notify = null;

            foreach (RepeaterItem r in rptCustPartHeader.Items)
            {
                Repeater rd = (Repeater)r.FindControl("rptSuppPartDetail");
                lnk = (LinkButton)rd.Items[0].FindControl("lnkSaveSupp");
                if (lnk.CommandArgument == cmdID)
                {
                    RadComboBox ddl1 = (RadComboBox)rd.Items[0].FindControl("ddlQSNotify1");
                    RadComboBox ddl2 = (RadComboBox)rd.Items[0].FindControl("ddlQSNotify2");
                    HiddenField hf   = (HiddenField)rd.Items[0].FindControl("hfQSNotify");
                    notify = null;
                    if (!string.IsNullOrEmpty(hf.Value))
                    {
                        notify = SQMModelMgr.LookupNotifyRecord(ctx, Convert.ToDecimal(hf.Value));
                    }
                    if (notify == null)
                    {
                        notify = SQMModelMgr.CreateNotifyRecord(SessionManager.EffLocation.Company.COMPANY_ID, 0, SessionManager.EffLocation.Plant.PLANT_ID, TaskRecordType.SupplierQualityIncident, Convert.ToDecimal(cmdID));
                    }
                    if (ddl1.SelectedIndex < 1)
                    {
                        notify.NOTIFY_PERSON1 = null;
                    }
                    else
                    {
                        notify.NOTIFY_PERSON1 = Convert.ToDecimal(ddl1.SelectedValue);
                    }

                    if (ddl2.SelectedIndex < 1)
                    {
                        notify.NOTIFY_PERSON2 = null;
                    }
                    else
                    {
                        notify.NOTIFY_PERSON2 = Convert.ToDecimal(ddl2.SelectedValue);
                    }

                    int status = SQMModelMgr.UpdateNotifyRecord(ctx, notify);
                }
            }
        }
Exemple #5
0
        public void BindNotifyList(PSsqmEntities ctx, decimal companyID, decimal busorgID, decimal plantID, List <TaskRecordType> recordTypeList)
        {
            ToggleVisible(pnlNotifyList);
            NOTIFY notify = null;

            scopeList = recordTypeList.Select(l => ((int)l).ToString()).ToList();
            List <NOTIFY> notifyList = new List <NOTIFY>();

            hfNotifyCompanyID.Value = SessionManager.EffLocation.Company.COMPANY_ID.ToString();
            hfNotifyBusorgID.Value  = busorgID.ToString();
            hfNotifyPlantID.Value   = plantID.ToString();
            hfNotifyB2BID.Value     = "0";

            if (plantID > 0)
            {
                staticPersonList = SQMModelMgr.SelectPlantPersonList(SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.Plant.PLANT_ID, "");
                notifyList       = SQMModelMgr.SelectNotifyList(ctx, 0, SessionManager.EffLocation.Plant.PLANT_ID, 0, scopeList);
            }
            else
            {
                staticPersonList = SQMModelMgr.SelectBusOrgPersonList(SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID);
                notifyList       = SQMModelMgr.SelectNotifyList(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, 0, 0, scopeList);
            }

            foreach (string scope in scopeList)
            {
                if ((notify = notifyList.Where(l => l.NOTIFY_SCOPE == scope).FirstOrDefault()) == null)
                {
                    notify = new NOTIFY();
                    notify.NOTIFY_SCOPE = scope; // xlat.Key;
                    notify.COMPANY_ID   = companyID;
                    if (busorgID > 0)
                    {
                        notify.BUS_ORG_ID = busorgID;
                    }
                    if (plantID > 0)
                    {
                        notify.PLANT_ID = plantID;
                    }
                    notifyList.Add(notify);
                }
            }

            notifyList = (from n in scopeList join s in notifyList on n equals s.NOTIFY_SCOPE select s).ToList();
            gvNotifyList.DataSource = notifyList;
            gvNotifyList.DataBind();
        }
Exemple #6
0
        public int UpdateNotifyList()
        {
            int           status = 0;
            PSsqmEntities ctx    = new PSsqmEntities();

            List <NOTIFY> notifyList = new List <NOTIFY>();

            if (Convert.ToDecimal(hfNotifyPlantID.Value) > 0)
            {
                notifyList = SQMModelMgr.SelectNotifyList(ctx, 0, SessionManager.EffLocation.Plant.PLANT_ID, 0, scopeList);
            }
            else
            {
                notifyList = SQMModelMgr.SelectNotifyList(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, 0, 0, scopeList);
            }

            NOTIFY nf = null;

            foreach (string scope in scopeList)
            {
                if ((nf = notifyList.Where(l => l.NOTIFY_SCOPE == scope).FirstOrDefault()) == null)
                {
                    nf = new NOTIFY();
                    nf.NOTIFY_SCOPE = scope; // xlat.Key;
                    notifyList.Add(nf);
                }
            }

            RadComboBox rdl1, rdl2;
            HiddenField hf;
            int         nrow = -1;

            foreach (NOTIFY notify in notifyList)
            {
                GridViewRow row = gvNotifyList.Rows[++nrow];

                notify.COMPANY_ID = Convert.ToDecimal(hfNotifyCompanyID.Value);
                if (!string.IsNullOrEmpty(hfNotifyBusorgID.Value))
                {
                    notify.BUS_ORG_ID = Convert.ToDecimal(hfNotifyBusorgID.Value);
                }
                if (hfNotifyPlantID.Value != "0")
                {
                    notify.PLANT_ID = Convert.ToDecimal(hfNotifyPlantID.Value);
                }
                if (hfNotifyB2BID.Value != "0")
                {
                    notify.B2B_ID = Convert.ToDecimal(hfNotifyB2BID.Value);
                }
                hf = (HiddenField)row.FindControl("hfScope");
                notify.NOTIFY_SCOPE = hf.Value;

                rdl1 = (RadComboBox)row.FindControl("ddlNotify1");
                if (!string.IsNullOrEmpty(rdl1.SelectedValue))
                {
                    notify.NOTIFY_PERSON1 = Convert.ToDecimal(rdl1.SelectedValue);
                }
                else
                {
                    notify.NOTIFY_PERSON1 = null;
                }

                rdl2 = (RadComboBox)row.FindControl("ddlNotify2");
                if (!string.IsNullOrEmpty(rdl2.SelectedValue))
                {
                    notify.NOTIFY_PERSON2 = Convert.ToDecimal(rdl2.SelectedValue);
                }
                else
                {
                    notify.NOTIFY_PERSON2 = null;
                }

                rdl1 = (RadComboBox)row.FindControl("ddlEscalate1");
                if (!string.IsNullOrEmpty(rdl1.SelectedValue))
                {
                    notify.ESCALATE_PERSON1 = Convert.ToDecimal(rdl1.SelectedValue);
                    rdl1 = (RadComboBox)row.FindControl("ddlEscalateDays1");
                    notify.ESCALATE_DAYS1 = Convert.ToInt32(rdl1.SelectedValue);
                }
                else
                {
                    notify.ESCALATE_PERSON1 = null;
                    notify.ESCALATE_DAYS1   = 0;
                }

                rdl2 = (RadComboBox)row.FindControl("ddlEscalate2");
                if (!string.IsNullOrEmpty(rdl2.SelectedValue))
                {
                    notify.ESCALATE_PERSON2 = Convert.ToDecimal(rdl2.SelectedValue);
                    rdl2 = (RadComboBox)row.FindControl("ddlEscalateDays2");
                    notify.ESCALATE_DAYS2 = Convert.ToInt32(rdl2.SelectedValue);
                }
                else
                {
                    notify.ESCALATE_PERSON2 = null;
                    notify.ESCALATE_DAYS2   = 0;
                }
            }

            status = SQMModelMgr.UpdateNotifyList(ctx, notifyList);

            if (status < 0)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveError');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
            }

            return(status);
        }