Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int campaignID = Request.Params["key"].ToInt();

            if (campaignID != 0)
            {
                CampaignEnter(campaignID);
            }
        }
        else
        {
            string code = Master.TextBoxCode.Text.Trim();
            Master.TextBoxCode.Text = "";

            if (code.Length == 0)
            {
                return;
            }

            if (BarcodeBLL.IsValidCampaignCode(code))
            {
                CampaignEnter(BarcodeBLL.ParseCampaignID(code));
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
        else
        {
            ucPeople.PeopleChanged += new EventHandler(ucPeople_PeopleChanged);

            string code = Master.TextBoxCode.Text.Trim();
            Master.TextBoxCode.Text = "";

            if (code.Length == 0)
            {
                return;
            }

            if (BarcodeBLL.IsValidDINCode(code))
            {
                DINEnter(code);
            }
            else if (BarcodeBLL.IsValidCampaignCode(code))
            {
                CampaignEnter(code);
            }
            else if (BarcodeBLL.IsValidProductCode(code))
            {
            }
            else
            {
                ucPeople.Code = code;
            }
        }
    }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string code = Master.TextBoxCode.Text.Trim();

            Master.TextBoxCode.Text = "";

            if (code.Length == 0)
            {
                return;
            }

            if (BarcodeBLL.IsValidCampaignCode(code))
            {
                ucCampaign1.CampaignID = BarcodeBLL.ParseCampaignID(code);
            }
            else
            {
            }
        }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Master.TextBoxCode.Text = Master.TextBoxCode.Text.Trim();

            if (Master.TextBoxCode.Text.Length == 0)
            {
                return;
            }

            if (BarcodeBLL.IsValidCampaignCode(Master.TextBoxCode.Text))
            {
                CampaignEnter(Master.TextBoxCode.Text);
            }

            Master.TextBoxCode.Text = "";
        }
    }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Master.TextBoxCode.Text = Master.TextBoxCode.Text.Trim();

                if (Master.TextBoxCode.Text.Length == 0)
                {
                }
                else
                {
                    if (BarcodeBLL.IsValidCampaignCode(Master.TextBoxCode.Text))
                    {
                        CampaignEnter(Master.TextBoxCode.Text);
                    }

                    Master.TextBoxCode.Text = "";
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), Guid.NewGuid().ToString(), "HightlightTR();", true);
            }
        }
    //isSOD: isStartOfDate
    //public static void ScanExp(bool isSOD)
    //{
    //if (!isSOD || !LogBLL.IsLog(Task.TaskX.ScanExp))
    //{
    //    RedBloodDataContext db = new RedBloodDataContext();

    //    List<Pack.StatusX> statusList = new List<Pack.StatusX> { Pack.StatusX.Product };

    //    IQueryable<Pack> rs = db.Packs.Where(r => statusList.Contains(r.Status) && r.ExpirationDate < DateTime.Now.Date);

    //    foreach (Pack r in rs)
    //    {
    //        PackStatusHistory h = PackBLL.Update(db, r, Pack.StatusX.Expired, RedBloodSystem.SODActor, "");

    //        if (h != null) db.PackStatusHistories.InsertOnSubmit(h);
    //    }

    //    db.SubmitChanges();

    //    LogBLL.Add(Task.TaskX.ScanExp);
    //}
    //}

    //isSOD: isStartOfDate
    //public static void CloseOrder(bool isSOD)
    //{
    //    //if (!isSOD || !LogBLL.IsLog(Task.TaskX.CloseOrder))
    //    //{
    //    //    RedBloodDataContext db = new RedBloodDataContext();

    //    //    OrderBLL.CloseOrder(db);

    //    //    db.SubmitChanges();

    //    //    LogBLL.Add(Task.TaskX.CloseOrder);
    //    //}
    //}

    //isSOD: isStartOfDate
    //public static void LockTestResult()
    //{
    //if (!isSOD || !LogBLL.IsLog(Task.TaskX.LockEnterTestResult))
    //{
    //    RedBloodDataContext db = new RedBloodDataContext();

    //    PackBLL.LockEnterTestResult();

    //    db.SubmitChanges();

    //    LogBLL.Add(Task.TaskX.LockEnterTestResult);
    //}
    //}

    /// <summary>
    /// if true, count remaining packs directly in store
    /// else count by sum up the remaining of previous date and total transaction in day
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    //static bool IsCountDirectly(DateTime date)
    //{
    //    RedBloodDataContext db = new RedBloodDataContext();

    //    bool isCountDirectly = false;

    //    //new system, no data
    //    if (db.PackTransactions.Count() == 0)
    //        isCountDirectly = true;
    //    else
    //    {
    //        if (lastPackTransactionDate == null) throw new Exception("");
    //        else
    //        {
    //            GetLastTransactionDate();

    //            //All pack transactions were in the previous of the date.
    //            if (lastPackTransactionDate.Value.Date <= date.Date)
    //                isCountDirectly = true;
    //        }
    //    }
    //    return isCountDirectly;
    //}

    public static void Find(HttpResponse Response, TextBox txtCode)
    {
        if (txtCode == null)
        {
            return;
        }

        string key = txtCode.Text.Trim();

        if (key.Length == 0)
        {
            return;
        }

        string pattern = @"\d+";
        Regex  regx    = new Regex(pattern);

        if (BarcodeBLL.IsValidPeopleCode(key))
        {
            People r = PeopleBLL.GetByCode(key);
            if (r != null)
            {
                Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString());
            }
        }
        else if (BarcodeBLL.IsValidDINCode(key))
        {
            Response.Redirect(RedBloodSystem.Url4PackDetail + "key=" + BarcodeBLL.ParseDIN(key));
        }
        else if (BarcodeBLL.IsValidCampaignCode(key))
        {
            Campaign r = CampaignBLL.Get(BarcodeBLL.ParseCampaignID(key));
            if (r != null)
            {
                Response.Redirect(RedBloodSystem.Url4CampaignDetail + "key=" + r.ID.ToString());
            }
        }
        else if (BarcodeBLL.IsValidOrderCode(key))
        {
            Order r = OrderBLL.Get(BarcodeBLL.ParseOrderID(key));
            if (r != null)
            {
                Response.Redirect(RedBloodSystem.Url4Order4CR + "key=" + r.ID.ToString());
            }
        }
        //TODO: Search by name
        else if (key.Length > 3 && key.Substring(0, 3) == "/n:")
        {
            Response.Redirect(RedBloodSystem.Url4FindPeople + "key=" + key.Substring(3).Trim());
        }
        else if (regx.IsMatch(key) && key.Length >= BarcodeBLL.CMNDLength.ToInt())
        {
            People r = PeopleBLL.GetByCMND(key);
            if (r != null)
            {
                Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString());
            }
        }

        txtCode.Text = "";
    }