Example #1
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.IsValidDINCode(code))
        {
            EnterDIN(BarcodeBLL.ParseDIN(code));
        }
        else if (BarcodeBLL.IsValidProductCode(code))
        {
            EnterProductCode(BarcodeBLL.ParseProductCode(code));
        }
        else if (BarcodeBLL.IsValidBloodGroupCode(code))
        {
            //TODO: ProductCode must enter before BloodGroup
            EnterBloodGroup(BarcodeBLL.ParseBloodGroupCode(code));
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int returnID = Request.Params["key"].ToInt();

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

            if (BarcodeBLL.IsValidDINCode(code))
            {
                LoadCurrentDIN(BarcodeBLL.ParseDIN(code));
            }
            else if (BarcodeBLL.IsValidReturnCode(code))
            {
                ReturnID = BarcodeBLL.ParseReturnID(code);
            }
            else if (BarcodeBLL.IsValidProductCode(code))
            {
                AddPackOrder(BarcodeBLL.ParseProductCode(code));
            }
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string code = Master.TextBoxCode.Text.Trim();

        Master.TextBoxCode.Text = "";

        if (BarcodeBLL.IsValidDINCode(code))
        {
            LoadDIN(BarcodeBLL.ParseDIN(code));
        }
        else if (BarcodeBLL.IsValidProductCode(code))
        {
            LoadPack(BarcodeBLL.ParseProductCode(code));
        }
    }
Example #4
0
    private void DINEnter(string code)
    {
        string tempDIN = BarcodeBLL.ParseDIN(code);

        RedBloodDataContext db = new RedBloodDataContext();
        Donation            d  = DonationBLL.Get(tempDIN);

        if (d == null)
        {
            this.Alert(DonationErrEnum.NonExist.Message);
            return;
        }

        if (d.PeopleID != null)
        {
            DIN            = tempDIN;
            ucPDL.PeopleID = d.PeopleID.Value;
            return;
        }

        if (ucPeople.PeopleID == Guid.Empty)
        {
            this.Alert("Chưa nhập thông tin người cho máu.");
            return;
        }
        if (CamDetailLeft.CampaignID == 0)
        {
            this.Alert("Chưa nhập thông tin đợt thu máu.");
            return;
        }

        DIN = tempDIN;

        DonationErr err = DonationBLL.Assign(DIN, ucPeople.PeopleID, CamDetailLeft.CampaignID);

        if (err != DonationErrEnum.Non)
        {
            this.Alert("Túi máu: " + err.Message);
        }
        else
        {
            ucPDL.ShowLog();
        }

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

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

                if (BarcodeBLL.IsValidDINCode(code))
                {
                    string DIN = BarcodeBLL.ParseDIN(code);
                    EnterDIN(DIN);
                }

                Master.TextBoxCode.Text = "";
            }
        }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int orgID = Request.Params["key"].ToInt();

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

            if (BarcodeBLL.IsValidDINCode(code))
            {
                LoadCurrentDIN(BarcodeBLL.ParseDIN(code));
            }
            else if (BarcodeBLL.IsValidOrderCode(code))
            {
                OrderID = BarcodeBLL.ParseOrderID(code);
            }
            else if (BarcodeBLL.IsValidProductCode(code))
            {
                AddPack(BarcodeBLL.ParseProductCode(code));
            }
            else if (BarcodeBLL.IsValidPeopleCode(code))
            {
                //People1.Code = code;
            }
            else if (code.Length >= 9)
            {
                //People1.Code = code;
            }
        }
    }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string code = Master.TextBoxCode.Text.Trim();

            Master.TextBoxCode.Text = "";

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


            if (rdbProductCodeIn.Checked)
            {
                if (BarcodeBLL.IsValidProductCode(code))
                {
                    ProductCodeInList = productionBLL.AddProductCodeIn(BarcodeBLL.ParseProductCode(code));
                    DataListProductIn.DataBind();
                }
            }
            else if (rdbProductCodeOut.Checked)
            {
                if (BarcodeBLL.IsValidProductCode(code))
                {
                    ProductCodeOutList = productionBLL.AddProductCodeOut(BarcodeBLL.ParseProductCode(code));
                    DataListProductOut.DataBind();
                }
            }
            else if (rdbDINIn.Checked)
            {
                if (BarcodeBLL.IsValidDINCode(code))
                {
                    DINInList = productionBLL.AddDIN(BarcodeBLL.ParseDIN(code));
                    DataListDINIn.DataBind();
                }
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string code = Master.TextBoxCode.Text.Trim();

            Master.TextBoxCode.Text = "";

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


            if (rdbProductCodeIn.Checked)
            {
                if (BarcodeBLL.IsValidProductCode(code))
                {
                    ProductCodeInList = productionBLL.AddProductCodeIn4Divide(BarcodeBLL.ParseProductCode(code));
                    DataListProductIn.DataBind();

                    GridViewVolume.DataSource = ProductionBLL.GetDivideList(code).Select(r => new
                    {
                        Division = r,
                        Volume   = "",
                    });
                    GridViewVolume.DataBind();
                }
            }
            else if (rdbDINIn.Checked)
            {
                if (BarcodeBLL.IsValidDINCode(code))
                {
                    DINInList = productionBLL.AddDIN4Divide(BarcodeBLL.ParseDIN(code));
                    DataListDINIn.DataBind();
                }
            }
        }
    //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 = "";
    }