Example #1
0
 public OtherCostsListRow(OtherCost OtherCost)
 {
     SelectedOtherCost = OtherCost;
     InitializeComponent();
     lOtherCostsInfo.Text = SetInfo();
     CreateNewMode        = false;
 }
Example #2
0
        public async Task <UpsertResponse <OtherCost> > PostOtherCost(OtherCost otherCost)
        {
            var body = JsonConvert.SerializeObject(
                otherCost, Formatting.None,
                new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            await AuthorizeIfNeeded();

            var url      = _baseUri + "/apis/360facility/v1/othercosts?";
            var content  = new StringContent(body, Encoding.UTF8, "application/json");
            var response = await _client.PostAsync(url, content);

            if (response.IsSuccessStatusCode)
            {
                var successCost =
                    JsonConvert.DeserializeObject <OtherCost>(
                        await response.Content.ReadAsStringAsync());
                return(new UpsertResponse <OtherCost>(true, null, successCost));
            }

            var failResponse =
                JsonConvert.DeserializeObject <FamisHttpResponse>(
                    await response.Content.ReadAsStringAsync());

            return(new UpsertResponse <OtherCost>(false, failResponse.Message, null));
        }
 public NewOtherCostsCreator() : base()
 {
     InitializeComponent();
     Mode   = CreatorMode.AddNew;
     Status = CreatorStatus.Edit;
     cbOtherCostsCategory.DataSource = Connection.TripperData.OtherCostsCatergories.ToList();
     selectedOtherCosts = new OtherCost();
 }
        public override void Execute()
        {
            var components = ChargeLine.Split("|");
            var otherCost  = new OtherCost();

            otherCost.InvoiceNumber = components[1];
            Record = otherCost;
        }
Example #5
0
        private void DoBatchDelete()
        {
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                OtherCost.DoBatchDelete(idList.ToArray());
            }
        }
Example #6
0
        public async Task <ActionResult> DeleteOtherCost(int id)
        {
            OtherCost otherCost = await _db.OtherCost.FindAsync(id);

            _db.OtherCost.Remove(otherCost);
            await _db.SaveChangesAsync(User.GetLoggedInUserName());

            return(Json(new { success = true }));
        }
Example #7
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            if (!SearchCriterion.Orders.Exists(en => en.PropertyName == "CreateTime"))
            {
                SearchCriterion.Orders.Add(new OrderCriterionItem("CreateTime", false));
            }

            ents = OtherCost.FindAll(SearchCriterion);
            this.PageState.Add("OtherCostList", ents);
        }
 public NewOtherCostsCreator(OtherCost row) : base()
 {
     Mode = BusinessLogic.CreatorMode.Edit;
     InitializeComponent();
     cbOtherCostsCategory.DataSource = Connection.TripperData.OtherCostsCatergories.ToList();
     selectedOtherCosts = row;
     tOtherCostName.GetData <string>(selectedOtherCosts.Name);
     cbOtherCostsCategory.SelectedItem = Connection.TripperData.OtherCostsCatergories.Single(category => category.OtherCategoryID == selectedOtherCosts.OtherCategoryID);
     tCost.GetData(selectedOtherCosts.Cost);
     tAdditonalInformations.GetData <string>(selectedOtherCosts.AdditionalInformation);
 }
Example #9
0
        private void NewOtherCostRow_AfterAdd(object sender, EventArgs e)
        {
            OtherCost lastInserted = Connection.TripperData.OtherCosts.Where(cost => cost.Trip == SelectedTrip).ToList().Last();

            OtherCostsList.Add(lastInserted);
            OtherCostsListRow OtherCostsRow = new OtherCostsListRow(lastInserted);

            OtherCostsRow.AfterUpdate += OtherCostsRow_AfterUpdate;
            pOtherCostsTable.Controls.Add(OtherCostsRow);
            OtherCostsRow.Dock = DockStyle.Top;
            OnAfterUpdate(EventArgs.Empty);
        }
Example #10
0
        public void StartFlow()
        {
            string    state = this.RequestData.Get <string>("state");
            string    id    = this.RequestData.Get <string>("Id");
            OtherCost pb    = OtherCost.Find(id);

            pb.State = state;
            pb.Save();
            string code = this.RequestData.Get <string>("FlowKey");

            //启动流程
            //表单路径,后面加上参数传入
            string formUrl = "/DailyManager/FrmOtherAppEdit.aspx?op=r&id=" + id;
            Guid   guid    = Aim.WorkFlow.WorkFlow.StartWorkFlow(id, formUrl, "其他费用报销申请(" + pb.LeaveUser + ")", code, this.UserInfo.UserID, this.UserInfo.Name);

            this.PageState.Add("FlowId", guid.ToString());
        }
Example #11
0
        public static string getOrderIdFromInvoice(AuditViewModel item, ApplicationDbContext db)
        {
            if (item.TableName == "Invoice")
            {
                Invoice invoice = db.Invoice.Where(x => x.InvoiceId.ToString() == item.KeyValue).FirstOrDefault();
                var     orderId = invoice != null?invoice.OrderId.ToString() : "0";

                return(orderId);
            }
            else if (item.TableName == "OtherCost")
            {
                OtherCost otherCost = db.OtherCost.Where(x => x.OtherCostId.ToString() == item.KeyValue).FirstOrDefault();
                var       orderId   = otherCost != null?otherCost.OrderId.ToString() : "0";

                return(orderId);
            }

            return(item.KeyValue);
        }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Application["carID"] != null)
        {
            car_id = Int32.Parse(Application["carID"].ToString());
            otherCost = new OtherCost();
        }
        else
            IdentityHelper.RedirectToReturnUrl(/*Request.QueryString["ReturnUrl"]*/"~/CarProfile.aspx", Response);

        
        if (!IsPostBack)
        {
            fillDDLCategory();
        }
        

    }
Example #13
0
        /// <summary>
        /// 保存操作
        /// </summary>
        private void DoSave()
        {
            OtherCost ent = null;

            id = FormData.Get <String>("Id");

            if (String.IsNullOrEmpty(id))
            {
                ent = this.GetPostedData <OtherCost>();
                ent.DoCreate();
            }
            else
            {
                ent = this.GetMergedData <OtherCost>();

                ent.DoUpdate();
            }

            this.SetFormData(ent);
        }
Example #14
0
File: DB.cs Project: rgg1992/Test
    public List<OtherCost> getOtherCostsForCar(int carId)
    {
        OtherCost item;
        List<OtherCost> others = new List<OtherCost>();
        try
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CarDiaryDB"].ToString());
            SqlDataReader dr;
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "dbo.getOtherCostsForCar";

            //set up the parameters
            cmd.Parameters.Add("@id", System.Data.SqlDbType.Int);
            //cmd.Parameters.Add("@price", System.Data.SqlDbType.Float).Direction = System.Data.ParameterDirection.Output;

            //set parameter values
            cmd.Parameters["@id"].Value = carId;

            cmd.Connection = conn;
            conn.Open();

            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                item = new OtherCost(dr.GetInt32(0), dr.GetInt32(1), dr.GetString(2), dr.GetString(3), dr.GetInt32(4), dr.GetDouble(5), dr.GetString(6));

                others.Add(item);
            }

            conn.Close();
        }
        catch (Exception ex)
        {
            // Log the exception.
            ExceptionUtility.LogException(ex, "DB.cs");
        }
        return others;
    }
Example #15
0
File: DB.cs Project: rgg1992/Test
    public bool addOtherCost(OtherCost input)
    {
        bool insert = false;
        try
        {
            string query = "dbo.addOtherCost";

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CarDiaryDB"].ToString());
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = query;
            cmd.Connection = conn;

            //set up the parameters
            cmd.Parameters.Add("@car", System.Data.SqlDbType.Int);
            cmd.Parameters.Add("@cat", System.Data.SqlDbType.NVarChar, 100);
            cmd.Parameters.Add("@dat", System.Data.SqlDbType.NVarChar, 100);
            cmd.Parameters.Add("@mil", System.Data.SqlDbType.Int);
            cmd.Parameters.Add("@cost", System.Data.SqlDbType.Float);
            cmd.Parameters.Add("@not", System.Data.SqlDbType.NVarChar, 1000);

            //set parameter values
            cmd.Parameters["@car"].Value = input.getCar_id();
            cmd.Parameters["@cat"].Value = input.getCategory();
            cmd.Parameters["@dat"].Value = input.getDate();
            cmd.Parameters["@mil"].Value = input.getMileage();
            cmd.Parameters["@cost"].Value = input.getTotal_cost();
            cmd.Parameters["@not"].Value = input.getNotes();


            cmd.Connection = conn;
            conn.Open();

            cmd.ExecuteNonQuery();

            insert = true;

            conn.Close();
        }
        catch (Exception ex)
        {
            insert = false;
            // Log the exception.
            ExceptionUtility.LogException(ex, "DB.cs");
        }

        return insert;
    }
Example #16
0
    private void fillOtherRow(int count, OtherCost item)
    {
        Table tbl = new Table();

        tbl.Width = new Unit("100%");
        tbl.Height = new Unit("100%");
        tbl.Style.Add("min-width", "330px !important");

        //------------------row-----------------------
        TableRow rw = new TableRow();
        if (count % 2 == 0)
            rw.BackColor = System.Drawing.Color.White;
        else
            rw.BackColor = System.Drawing.Color.LightGray;
        //---------------------cell--------------
        TableCell cell = new TableCell();
        cell.Width = new Unit("10%");

        Label date = new Label();
        date.Width = new Unit("100%");
        date.Style.Add("text-align", "center");
        date.Font.Size = 10;
        date.Text = item.getDate();

        cell.Controls.Add(date);
        rw.Cells.Add(cell);

        //---------------------cell--------------
        cell = new TableCell();
        cell.Width = new Unit("15%");

        Label mileage = new Label();
        mileage.Width = new Unit("100%");
        mileage.Style.Add("text-align", "center");
        mileage.Font.Size = 10;
        mileage.Text = item.getMileage().ToString("0.##");

        cell.Controls.Add(mileage);
        rw.Cells.Add(cell);

        //---------------------cell--------------
        cell = new TableCell();
        cell.Width = new Unit("50%");

        Label category = new Label();
        category.Width = new Unit("100%");
        category.Style.Add("text-align", "center");
        category.Font.Size = 10;
        category.Text = item.getCategory();

        cell.Controls.Add(category);
        rw.Cells.Add(cell);

        //---------------------cell--------------
        cell = new TableCell();

        cell.Width = new Unit("10%");

        Label price = new Label();
        price.Width = new Unit("100%");
        price.Style.Add("text-align", "center");
        price.Font.Size = 10;
        price.Text = item.getTotal_cost().ToString("0.##");

        cell.Controls.Add(price);
        rw.Cells.Add(cell);

        //---------------------cell--------------
        cell = new TableCell();
        cell.Width = new Unit("8%");

        ImageButton delete = new ImageButton();
        //Image img = new Image();
        //img.ImageUrl = "~/delete.ico";
        //delete.BackgroundImage = img;
        delete.ImageUrl = "~/Images/delete.png";
        delete.Style.Add("height", "20px");
        delete.Style.Add("width", "20px");
        delete.ID = "DeleteOther" + item.getId();
        delete.Click += new ImageClickEventHandler(DeleteOtherCost_Click);
        delete.ToolTip = "Изтрий";

        cell.Controls.Add(delete);
        rw.Cells.Add(cell);

        //---------------------cell--------------
        cell = new TableCell();
        cell.Width = new Unit("7%");



        ImageButton notes = new ImageButton();
        notes.ImageUrl = "~/Images/icon_note.png";
        notes.Style.Add("height", "20px");
        notes.Style.Add("width", "20px");
        notes.ID = "Notes" + item.getId();
        //notes.Click += new ImageClickEventHandler(ShowNotes_Click);
        string noteText = item.getNotes();
        if (!noteText.Equals(""))
            notes.ToolTip = noteText;
        else
            notes.ToolTip = "Няма въведени записки за този разход";
        notes.Enabled = false;

        cell.Controls.Add(notes);
        rw.Cells.Add(cell);

        tbl.Controls.Add(rw);

        Panel2.Controls.Add(tbl);
    }
Example #17
0
 public OtherCostsListRow()
 {
     SelectedOtherCost = new OtherCost();
     InitializeComponent();
     CreateNewMode = true;
 }
Example #18
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            OtherCost ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <OtherCost>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <OtherCost>();

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getOtherCostsNumber()") + "";

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <OtherCost>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "save")
                {
                    DoSave();
                }
                else if (RequestActionString == "submitfinish")
                {
                    OtherCost pc = OtherCost.Find(this.RequestData.Get <string>("id"));
                    pc.State    = "End";
                    pc.AppState = this.RequestData.Get <string>("ApprovalState");
                    pc.Save();
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = OtherCost.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }

            if (op == "c")
            {
                PageState.Add("ReleDepartment", DataHelper.QueryValue("select " + db + ".dbo.get_DeptName('" + UserInfo.UserID + "')"));
            }
            this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));
            PageState.Add("OtherCost", SysEnumeration.GetEnumDict("OtherCost"));
        }