Example #1
0
        public override void ImportToDatabase()
        {
            DataTable dataTable = GetImportDataFromTempDatabase(null);

            if (dataTable.Rows.Count > 0)
            {
                ECommissionAchievementImportBatch batchDetail = new ECommissionAchievementImportBatch();
                batchDetail.CAImportBatchDateTime = AppUtils.ServerDateTime();
                //batchDetail.CAImportBatchOriginalFilename = OriginalBatchFilename;
                batchDetail.CAImportBatchRemark     = Remark;
                batchDetail.CAImportBatchUploadedBy = m_UserID;
                ECommissionAchievementImportBatch.db.insert(dbConn, batchDetail);

                foreach (DataRow row in dataTable.Rows)
                {
                    EUploadCommissionAchievement obj = new EUploadCommissionAchievement();
                    EUploadCommissionAchievement.db.toObject(row, obj);

                    ECommissionAchievement CA = new ECommissionAchievement();
                    CA.CAPercent       = obj.CAPercent;
                    CA.CAEffDate       = obj.CAEffDate;
                    CA.EmpID           = obj.EmpID;
                    CA.CAImportBatchID = batchDetail.CAImportBatchID;

                    ECommissionAchievement.db.insert(dbConn, CA);
                    EUploadCommissionAchievement.db.delete(dbConn, obj);
                }
            }
        }
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        ECommissionAchievement obj = new ECommissionAchievement();

        db.toObject(((DataRowView)e.Item.DataItem).Row, obj);
        Hashtable values = new Hashtable();

        db.populate(obj, values);

        {
            //((Button)e.Item.FindControl("Edit")).Visible = IsAllowEdit;
            //if (obj.PayRecID != null)
            //{
            //    ((Button)e.Item.FindControl("Edit")).Visible = false;
            //    ((CheckBox)e.Item.FindControl("DeleteItem")).Visible = false;
            //}
            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("CAID");
            h.Value = obj.CAID.ToString();



            Label CAPercent = (Label)e.Item.FindControl("CAPercent");
            Label CAEffDate = (Label)e.Item.FindControl("CAEffDate");

            Binding ebinding = new Binding(dbConn, db);
            ebinding.add(CAPercent);
            ebinding.add(CAEffDate);
//            ebinding.add(new BlankZeroLabelVLBinder(EEmpBankAccount.db, EmpAccID, "EmpAccID", EEmpBankAccount.VLBankAccount).setTextDisplayForZero(HROne.Common.WebUtility.GetLocalizedString(EEmpBankAccount.DEFAULT_BANK_ACCOUNT_TEXT)));
            ebinding.init(Request, Session);
            ebinding.toControl(values);

            DBFilter empRankFilter = new DBFilter();
            empRankFilter.add(WebUtils.AddRankFilter(Session, "EmpID", true));
            empRankFilter.add(new Match("EmpID", obj.EmpID));
            if (EEmpPersonalInfo.db.count(dbConn, empRankFilter) > 0)
            {
                CAPercent.Text = obj.CAPercent.ToString("#0.00");
                if (!obj.CAEffDate.Ticks.Equals(0))
                {
                    CAEffDate.Text = obj.CAEffDate.ToString("yyyy-MM-dd");
                }
            }
            else
            {
                CAPercent.Text = "******";
                CAEffDate.Text = "******";
            }
        }
    }